:root {
  --ground: #e3e6e4;
  --surface: #f3f4f2;
  --ink: #1b1f1e;
  --muted: #59625e;
  --line: #c6ccc9;
  --c: #2e5bba;
  --th: #c98d12;
  --l: #c43d2a;
  --s: #2f7d63;
  --nc: #4f67b0;
  --vc: #b0603a;
  --ob: #7356ad;
  --ra: #23808f;
  --mo: #7a4fae; --zp: #2f8a58; --zr: #b8760f; --zw: #c4533f;
  --focus: #2e5bba;
  --facet: #0f7f8a;
  --shadow: 0 1px 0 rgba(27, 31, 30, .06);
  --font-display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ground: #141817;
    --surface: #1c2120;
    --ink: #e7ebe9;
    --muted: #9aa39f;
    --line: #2f3634;
    --c: #6f96e6;
    --th: #e2b04a;
    --l: #e6705c;
    --s: #5fb495;
    --nc: #8a9ee6;
    --vc: #e38e66;
    --ob: #ab93e3;
    --ra: #5cc0cc;
    --mo: #b48ee0; --zp: #63c48f; --zr: #e8b04f; --zw: #ee8672;
    --focus: #8fb0f0;
    --facet: #4cc4cf;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #141817;
  --surface: #1c2120;
  --ink: #e7ebe9;
  --muted: #9aa39f;
  --line: #2f3634;
  --c: #6f96e6;
  --th: #e2b04a;
  --l: #e6705c;
  --s: #5fb495;
  --nc: #8a9ee6;
  --vc: #e38e66;
  --ob: #ab93e3;
  --ra: #5cc0cc;
  --mo: #b48ee0; --zp: #63c48f; --zr: #e8b04f; --zw: #ee8672;
  --focus: #8fb0f0;
  --facet: #4cc4cf;
  --shadow: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.app {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  padding-inline: 16px;
  padding-block: 12px 16px;
  gap: 12px;
}

/* ---------- Header ---------- */
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
}
.brand { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 125%;
  font-size: clamp(20px, 2.4vw, 28px);
  letter-spacing: -0.01em;
  line-height: 1;
  text-transform: uppercase;
}
.brand .sub {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.draft {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px dashed var(--line);
  padding: 4px 8px;
}
.modes { margin-left: auto; display: flex; border: 1px solid var(--ink); }
.modes button {
  border: 0;
  background: transparent;
  padding: 7px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
}
.modes button[aria-pressed="true"] { background: var(--ink); color: var(--ground); }

/* ---------- Main grid ---------- */
.main {
  min-height: 0;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) minmax(300px, 380px);
  gap: 12px;
}

/* Ruler (spine navigator) */
.ruler {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.ruler .group { display: flex; flex-direction: column; gap: 1px; border-left: 4px solid var(--rc); padding-left: 6px; }
.ruler .glabel {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--rc);
  padding-block: 2px;
}
.ruler button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  border: 0;
  background: transparent;
  padding: 2px 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  text-align: left;
}
.ruler button::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.ruler button:hover { color: var(--rc); }
.ruler button[aria-current="true"] { background: var(--rc); color: var(--surface); }
.ruler button[aria-current="true"]::after { background: currentColor; }

/* Stage */
.stage {
  position: relative;
  min-height: 0;
  background:
    radial-gradient(ellipse 60% 55% at 50% 48%, var(--surface), transparent 75%),
    var(--ground);
  border: 1px solid var(--line);
  overflow: hidden;
}
.stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.bigcode {
  position: absolute;
  left: 16px;
  top: 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 125%;
  font-size: clamp(64px, 11vw, 168px);
  line-height: .9;
  letter-spacing: -0.03em;
  color: var(--rc, var(--ink));
  opacity: .16;
  pointer-events: none;
  user-select: none;
  transition: color .3s;
}
.stage .hint {
  position: absolute;
  right: 12px;
  top: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  pointer-events: none;
  text-align: right;
}
.toolbar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.seg { display: flex; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.seg button, .chip {
  border: 0;
  background: transparent;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--ground); }
.seg button:hover, .chip:hover { background: var(--ground); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.chip .box { width: 12px; height: 12px; border: 1.5px solid var(--ink); display: inline-grid; place-items: center; }
.chip[aria-pressed="true"] .box::after { content: ""; width: 6px; height: 6px; background: var(--ink); }
.loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}
.loader .bar { width: 180px; height: 2px; background: var(--line); margin-top: 8px; }
.loader .bar i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .2s; }

/* Labels on the model */
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.labels svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ll { fill: none; stroke: var(--ink); stroke-width: 1; opacity: .55; }
.ll.behind { stroke-dasharray: 3 3; opacity: .35; }
.ll.focus { stroke: var(--rc, var(--ink)); stroke-width: 2; opacity: 1; }
.ld { fill: var(--surface); stroke: var(--ink); stroke-width: 1.5; }
.ld.palp { fill: var(--ink); }
.ld.behind { opacity: .45; }
.ld.mini { r: 2.5; opacity: .6; }
.lbl {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  line-height: 1.2;
  padding: 3px 6px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  white-space: normal;
  transition: opacity .2s;
}
.lbl b { font-weight: 600; font-size: 13px; }
.lbl span { font-size: 11px; color: var(--muted); font-style: italic; }
.lbl.palp-kind b { font-family: var(--font-mono); font-weight: 500; }
.lbl.palp-kind span { font-style: normal; }
.lbl.left { text-align: right; }
.lbl.behind { opacity: .55; }
.lbl.focus { outline: 2px solid var(--rc, var(--ink)); opacity: 1; }
.zoomhint {
  position: absolute;
  left: 16px;
  bottom: 60px;
  max-width: 300px;
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
}

/* Parts list in panel */
.parts { margin: 0; display: grid; gap: 2px; }
.prow { padding: 6px 8px; margin-inline: -8px; cursor: default; }
.prow:hover, .prow:focus { background: var(--ground); outline: none; }
.prow dt { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prow dt em { font-style: normal; font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.prow dd { margin: 2px 0 0 18px; font-size: 13.5px; color: var(--muted); }
.pd { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--ink); flex: none; }
.pd.palp { background: var(--ink); }

/* Label status + edit mode */
.lmstatus { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; font-size: 12.5px; color: var(--muted); margin: 0 0 8px; padding: 8px 10px; border: 1px dashed var(--line); }
.lmstatus.ok { border-style: solid; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 13px; }
.linkbtn:hover { color: var(--rc, var(--ink)); }
.check { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); background: var(--ground); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--rc, var(--ink)); }
.check small { color: var(--muted); }
.steps { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13.5px; color: var(--muted); }
.elist { display: grid; gap: 2px; }
.erow { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 8px; margin-inline: -8px; }
.erow.active { background: var(--ground); }
.erow b { display: block; font-weight: 600; font-size: 14px; }
.erow small { font-family: var(--font-mono); font-size: 10px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.erow small.fx { color: var(--rc, var(--ink)); }
.slots { display: flex; gap: 4px; flex: none; }
.slot { border: 1px solid var(--line); background: var(--surface); padding: 4px 8px; font-size: 12px; cursor: pointer; }
.slot:hover { border-color: var(--ink); }
.slot.empty { border-style: dashed; color: var(--muted); }
.slot.on { background: var(--rc, var(--ink)); border-color: var(--rc, var(--ink)); color: var(--surface); }
.ectl { border: 1px solid var(--rc, var(--ink)); padding: 10px 12px; display: grid; gap: 10px; margin: 2px 0 8px; }
.ectl .feedback { font-size: 13px; margin: 0; }
.nudge { display: grid; grid-template-columns: repeat(4, auto) 1fr; gap: 6px; justify-content: start; }
.nudge button { border: 1px solid var(--line); background: var(--ground); padding: 6px 10px; cursor: pointer; font-size: 13px; }
.nudge button:hover { border-color: var(--ink); }
.erow-actions { display: flex; flex-wrap: wrap; gap: 14px; }
.export { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.export p { font-size: 13.5px; }
.export .small { font-size: 12px; color: var(--muted); }
.ebtns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.export textarea { width: 100%; min-height: 140px; font-family: var(--font-mono); font-size: 11px; background: var(--ground); color: var(--ink); border: 1px solid var(--line); padding: 8px; }
.btn.ghost { background: transparent; color: var(--ink); }
.ld.focus { stroke: var(--rc, var(--ink)); stroke-width: 3; r: 6; }
body.editing .stage { outline: 2px dashed var(--rc, var(--ink)); outline-offset: -2px; }
body.editing .stage::after {
  content: "Tryb edycji punktów";
  position: absolute; right: 12px; top: 10px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--rc, var(--ink)); pointer-events: none;
}
body.editing .hint { display: none; }

/* Ribs block */
.ribs-block ul { margin: 0 0 6px; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; }
.ribs-block .small { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0; }
.swatch { display: inline-block; width: 12px; height: 12px; background: var(--facet); flex: none; }

/* Panel */
.panel {
  min-height: 0;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 20px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--rc);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.panel h2 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 112%;
  font-size: 26px;
  line-height: 1.1;
  text-wrap: balance;
}
.latin { margin: 2px 0 0; font-style: italic; color: var(--muted); }
.panel h3 {
  margin: 0 0 6px;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.panel ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.panel p { margin: 0; }
.note {
  border: 1px solid var(--rc);
  padding: 12px 14px;
}
.note h3 { color: var(--rc); }
.region-text { color: var(--muted); font-size: 14px; }
.meta {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  display: grid;
  gap: 6px;
}
.meta a { color: inherit; }
.meta code { font-family: var(--font-mono); font-size: 11px; }

/* Quiz */
.quiz-q { font-family: var(--font-display); font-weight: 700; font-stretch: 112%; font-size: 20px; line-height: 1.2; margin: 0; }
.answers { display: grid; gap: 8px; }
.answers button {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--ground);
  padding: 10px 12px;
  cursor: pointer;
}
.answers button:hover:not(:disabled) { border-color: var(--ink); }
.answers button .code { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.answers button.ok { border-color: var(--s); background: color-mix(in srgb, var(--s) 16%, var(--surface)); }
.answers button.bad { border-color: var(--l); background: color-mix(in srgb, var(--l) 14%, var(--surface)); }
.score { font-family: var(--font-mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.btn {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--ground);
  padding: 9px 14px;
  cursor: pointer;
  justify-self: start;
}
.feedback { font-size: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .main { grid-template-columns: 64px minmax(0, 1fr); grid-template-rows: minmax(420px, 62vh) auto; }
  .panel { grid-column: 1 / -1; overflow: visible; }
  .app { height: auto; min-height: 100%; }
}
@media (max-width: 640px) {
  .main { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(380px, 60vh) auto; }
  .ruler { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; }
  .ruler .group { flex-direction: row; align-items: center; border-left: 0; border-top: 4px solid var(--rc); padding: 4px 0 0; }
  .ruler .glabel { display: none; }
  .ruler button::after { display: none; }
  .ruler button { padding: 6px 8px; }
  .modes { margin-left: 0; }
  .stage .hint { display: none; }
  .zoomhint { display: none; }
  .lbl b { font-size: 11.5px; }
  .lbl span { display: none; }
  .stage { display: flex; flex-direction: column; }
  .stage canvas { flex: 1; min-height: 0; height: auto; }
  .toolbar { position: static; padding: 8px; gap: 6px; border-top: 1px solid var(--line); background: var(--surface); }
  .toolbar .chip, .toolbar .seg { box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Licznik wydajności (#debug) */
.dbg {
  position: absolute; right: 12px; top: 44px; z-index: 5;
  font-family: var(--font-mono); font-size: 11px; line-height: 1.5;
  color: var(--ink); background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--line); padding: 6px 8px; pointer-events: auto;
}
.dbg b { font-size: 14px; }
.dbg button { font: inherit; border: 1px solid var(--line); background: transparent; color: var(--ink); padding: 0 6px; cursor: pointer; }
.dbg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }

/* ---------- Moduły ---------- */
.modbtn {
  display: inline-flex; align-items: center; gap: 10px;
  border: 1px solid var(--ink); background: var(--surface);
  padding: 6px 12px; cursor: pointer; min-height: 34px;
}
.modbtn .modk { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.modbtn #modname { font-weight: 600; font-size: 14px; }
.modbtn .caret { width: 7px; height: 7px; border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); transform: translateY(-2px) rotate(45deg); }
.modbtn:hover { background: var(--ground); }

.picker {
  position: absolute; inset: 0; z-index: 6;
  display: grid; place-items: center;
  padding: 16px; overflow: auto;
  background: color-mix(in srgb, var(--ground) 92%, transparent);
}
.pk { width: min(640px, 100%); display: grid; gap: 14px; }
.pk-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pk-eyebrow { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pk h2 {
  margin: 2px 0 0; font-family: var(--font-display); font-weight: 800; font-stretch: 112%;
  font-size: clamp(22px, 3vw, 30px); line-height: 1.05; text-transform: uppercase; letter-spacing: -0.01em;
}
.pk-close { border: 1px solid var(--ink); background: var(--surface); width: 36px; height: 36px; font-size: 20px; line-height: 1; cursor: pointer; }
.pk-lead { margin: 0; color: var(--muted); max-width: 52ch; }
.pk-list { display: grid; gap: 8px; }
.pk-card {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  text-align: left; padding: 12px 14px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.pk-card:hover { border-color: var(--ink); }
.pk-card[aria-current="true"] { border: 2px solid var(--ink); padding: 11px 13px; }
.pk-icon { width: 44px; height: 56px; color: var(--ink); }
.pk-icon svg { width: 100%; height: 100%; display: block; }
.pk-text { display: grid; gap: 2px; }
.pk-text b { font-size: 16px; }
.pk-text span { font-size: 13px; color: var(--muted); line-height: 1.4; }
.pk-size { display: grid; justify-items: end; text-align: right; gap: 2px; font-family: var(--font-mono); }
.pk-size b { font-size: 14px; font-weight: 500; white-space: nowrap; }
.pk-size span { font-size: 10.5px; color: var(--muted); letter-spacing: .02em; max-width: 16ch; }
.pk-foot { margin: 0; font-size: 12px; color: var(--muted); font-family: var(--font-mono); line-height: 1.5; }

.net {
  position: absolute; left: 12px; bottom: 56px; z-index: 4;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em;
  background: var(--surface); border: 1px solid var(--line); padding: 4px 8px;
  pointer-events: none;
}
.net::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; background: var(--ink); vertical-align: 1px; animation: netblink 1s steps(2) infinite; }
.net.err { border-color: var(--l); }
.net.err::before { background: var(--l); animation: none; }
@keyframes netblink { 50% { opacity: .2; } }
.loader .btn { margin-top: 10px; }

@media (max-width: 640px) {
  .modbtn { order: 3; width: 100%; justify-content: space-between; }
  .pk-card { grid-template-columns: 34px minmax(0, 1fr); gap: 10px; }
  .pk-icon { width: 34px; height: 44px; }
  .pk-size { grid-column: 2; justify-items: start; text-align: left; display: flex; gap: 8px; align-items: baseline; }
  .pk-size span { max-width: none; }
  .net { top: 8px; bottom: auto; left: 8px; }
  .picker { place-items: start center; }
}
@media (max-width: 640px) {
  .picker { position: fixed; z-index: 50; background: var(--ground); padding: 20px 16px 28px; }
}

/* ---------- Mięśnie ---------- */
:root { --muscle: #b4412f; --muscle-soft: #cf9a90; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --muscle: #d8644f; --muscle-soft: #8f5f57; } }
:root[data-theme="dark"] { --muscle: #d8644f; --muscle-soft: #8f5f57; }
.chipgroup { display: inline-flex; gap: 8px; }
.pk-group { display: grid; gap: 8px; }
.pk-gtitle { margin: 4px 0 0; font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* Lewa kolumna w modułach mięśni i zestawów kości: nazwy zamiast kodów kręgów */
body[data-ruler="names"] .main { grid-template-columns: 148px minmax(0, 1fr) minmax(300px, 380px); }
.ruler.mus .group { gap: 2px; }
.ruler.mus button { font-family: var(--font-body); font-size: 13px; line-height: 1.25; padding: 4px 6px; white-space: normal; }
.ruler.mus button::after { display: none; }
.ruler.mus .mgroup:has(button) { border-left-color: var(--muscle); }
.ruler.mus .mgroup:not(:has(button)) { border-left-color: var(--line); }
.ruler.mus .mgroup:not(:has(button)) .glabel { color: var(--muted); }
.mpart { padding: 10px 0 2px; border-top: 1px solid var(--line); }
.mpart:first-child { border-top: 0; padding-top: 0; }
.mpart h4 { margin: 0 0 6px; font-size: 15px; }
.mpart h4 i { font-weight: 400; color: var(--muted); font-size: 13px; }
.mdl { margin: 0; display: grid; gap: 6px; }
.mrow dt { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.mrow dd { margin: 0; }
.attach-note { margin: 6px 0 0; color: var(--muted); }
.mpart:focus-visible, .mpart:hover { outline: none; }
.mpart:hover h4, .mpart:focus h4 { color: var(--muscle); }
@media (max-width: 1000px) { body[data-ruler="names"] .main { grid-template-columns: 120px minmax(0, 1fr); } }
@media (max-width: 640px) {
  body[data-ruler="names"] .main { grid-template-columns: minmax(0, 1fr); }
  .ruler.mus .mgroup:not(:has(button)) { display: none; }
}
.chip { white-space: nowrap; }

/* Quiz: rodzaj pytań */
.qtypes { display: flex; flex-wrap: wrap; gap: 0; margin: 10px 0 4px; border: 1px solid var(--ink); width: fit-content; }
.qtypes button { border: 0; background: transparent; padding: 5px 10px; font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .04em; cursor: pointer; }
.qtypes button + button { border-left: 1px solid var(--ink); }
.qtypes button[aria-pressed="true"] { background: var(--ink); color: var(--ground); }

/* Punkty dodane ręcznie */
.lmlinks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.parts em.added { font-style: normal; font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border: 1px dashed var(--line); padding: 0 4px; }
.addpt { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.addpt h3 { margin: 0; }
.addpt p { margin: 0; }
.exform { display: grid; gap: 8px; }
.exform label:not(.check) { display: grid; gap: 3px; font-size: 13px; }
.exform small { color: var(--muted); }
.exform input:not([type]), .exform input[name="name"], .exform input[name="latin"], .exform textarea {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); padding: 6px 8px; width: 100%;
}
.exform input:focus, .exform textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.exedit { margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 8px; }
.exedit summary { cursor: pointer; font-size: 13px; color: var(--muted); margin-bottom: 8px; }

/* Bez internetu */
.pk-offline { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.pk-note { margin: 0; font-size: 13px; color: var(--muted); }
.pk-offlist { display: grid; gap: 4px; }
.pk-off { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; font-size: 14px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.pk-offsize { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.pk-off .chip { min-width: 108px; justify-content: center; box-shadow: none; }
.pk-off .chip:disabled { cursor: default; color: var(--muted); }
.net.off { border-style: dashed; }
.net.off::before { animation: none; background: var(--muted); }

/* ---------- Zestawy podpisów (np. łopatka: kąty i brzegi, grzebień i wyrostki, panewka i doły) ---------- */
:root { --lg1: #c4533f; --lg2: #2f6fb8; --lg3: #2f8a58; --lg4: #a8730f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --lg1: #ee8672; --lg2: #74aeea; --lg3: #63c48f; --lg4: #e2b04a; } }
:root[data-theme="dark"] { --lg1: #ee8672; --lg2: #74aeea; --lg3: #63c48f; --lg4: #e2b04a; }
.lgroups { position: absolute; left: 12px; top: 10px; z-index: 2; display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 24px); }
.lgroups button, .pgroup {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow);
  padding: 5px 9px; font-size: 13px; cursor: pointer;
}
.lgroups button:hover, .pgroup:hover { background: var(--ground); }
.lgroups button[aria-pressed="true"], .pgroup[aria-pressed="true"] { border-color: var(--g, var(--ink)); box-shadow: inset 0 -3px 0 var(--g, var(--ink)); font-weight: 600; }
.sw { width: 10px; height: 10px; border-radius: 50%; background: var(--g); flex: none; }
.lbl.grouped { border-left: 3px solid var(--g); }
.ld.grouped { stroke: var(--g); stroke-width: 2.5; }
.ld.grouped.palp { fill: var(--g); }
.ld.mini.grouped { fill: var(--g); stroke: none; r: 3.5; opacity: .75; }
.ld.mini.grouped.behind { opacity: .3; }
.pgroup { width: 100%; justify-content: flex-start; margin: 10px 0 4px; text-align: left; }
.pgroup small { margin-left: auto; color: var(--muted); font-weight: 400; font-family: var(--font-mono); font-size: 11px; }
.prow .pd.grouped { border-color: var(--g); }
.prow .pd.grouped.palp { background: var(--g); }
body.editing .lgroups { display: none; }
@media (max-width: 640px) { .lgroups button { padding: 4px 7px; font-size: 12px; } }
.stage:has(.lgroups:not([hidden]) [data-lg]) .hint, .stage:has(.selftest[aria-pressed="true"]) .hint { display: none; }
/* „Sprawdź się”: kropki do odkrycia nazwy */
.lgset { display: contents; }
.lgroups .selftest { font-weight: 600; }
.lgroups .selftest[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); box-shadow: var(--shadow); }
.lgset:not(:empty) + .selftest { margin-left: 8px; }
.tcount { align-self: center; padding: 0 4px; font-family: var(--font-mono); font-size: 12px; color: var(--muted); background: var(--surface); }
.ld.ask { r: 6.5; fill: var(--g, var(--ink)); stroke: var(--surface); stroke-width: 2; opacity: 1; cursor: pointer; }
.ld.ask.behind { opacity: .4; }
@media (max-width: 640px) { .lgset:not(:empty) + .selftest { margin-left: 0; } .ld.ask { r: 7.5; } }
