/* Plansza X — Anatomia ustawy: macierz podobieństwa artykułów + odesłania. Dziedziczy skórkę z atlas.css. */

/* wyszukiwarka ustawy u góry płótna (jak na planszy IX) */
.search { position: absolute; left: 14px; top: 6px; z-index: 6; width: 190px; }
.search input { width: 100%; background: rgba(8, 11, 17, 0.9); padding: 5px 10px; }
.sugg {
  width: 400px; list-style: none; margin: 4px 0 0; padding: 4px 0; max-height: 360px; overflow-y: auto;
  background: var(--ground-deep); border: 1px solid var(--rule); border-radius: 3px;
}
.sugg li { padding: 5px 12px; cursor: pointer; font-size: var(--t-sm); display: flex; gap: 10px; align-items: baseline; }
.sugg li b { font-family: var(--serif); font-weight: 500; white-space: nowrap; min-width: 5.5ch; }
.sugg li span { color: var(--ink-muted); font-size: var(--t-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.sugg li small { color: var(--ink-faint); font-size: var(--t-xs); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sugg li[aria-selected="true"], .sugg li:hover { background: var(--ground-lift); }
.sugg li[aria-selected="true"] b { background: none; color: var(--brass); }
.act-title { position: absolute; left: 216px; right: 24px; top: 8px; z-index: 5; font-family: var(--serif); font-size: var(--t-md); color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.act-title b { font-weight: 500; color: var(--paper); }

/* macierz: kwadrat ustawiany z JS; pasek metryki nad nią, podpisy po lewej */
.wrap { position: absolute; z-index: 1; }
.wrap.loading .mat { opacity: 0.35; }
.strip-cap { position: absolute; left: 0; right: 0; top: -17px; overflow: hidden; text-overflow: ellipsis; font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-faint); white-space: nowrap; }
.strip { display: block; width: 100%; height: 16px; cursor: crosshair; }
.mat { position: relative; margin-top: 4px; transition: opacity 0.25s; user-select: none; -webkit-user-select: none; }
.mat canvas { display: block; position: absolute; inset: 0; }
#img { image-rendering: pixelated; }
#ov { cursor: crosshair; }
#ov.pan { cursor: grab; }
#ov.panning { cursor: grabbing; }
/* zaznaczenie do powiększenia (prostokąt rysowany podczas przeciągania) */
.brush { position: absolute; pointer-events: none; border: 1px solid var(--brass); background: rgba(232, 184, 102, 0.12); box-shadow: 0 0 0 1px rgba(8, 11, 17, 0.6); }
.hint { position: absolute; left: 0; right: 92px; bottom: -16px; font-size: 10px; color: var(--ink-faint); letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
button.toggle[aria-pressed="true"] { color: var(--brass); border-color: var(--brass); }
#ov:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }
.axes { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.axes text { fill: var(--ink-faint); font-family: var(--sans); font-size: 10px; }
.axes text.sel { fill: var(--brass); font-family: var(--serif); font-size: 11.5px; }
.axes line { stroke: var(--rule); }
.axes line.sel { stroke: var(--brass); }
.corner { position: absolute; right: 0; bottom: -16px; font-size: 10px; color: var(--ink-faint); letter-spacing: 0.04em; text-transform: uppercase; }

/* sterowanie u dołu: żetony rodzajów odesłań + metryka paska */
.controls { flex-direction: column; align-items: flex-start; gap: 8px; left: 0; right: 0; bottom: 0; padding: 14px 24px 14px; background: linear-gradient(rgba(11, 15, 23, 0), var(--ground) 45%); }
.controls .row { display: flex; align-items: center; gap: 6px 8px; flex-wrap: wrap; }
.controls .lbl { font-size: var(--t-xs); color: var(--ink-faint); margin-right: 2px; }
.controls .seg button { font-size: var(--t-xs); padding: 4px 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chips button { display: inline-flex; align-items: center; gap: 7px; font-size: var(--t-xs); padding: 4px 10px 4px 8px; border-radius: 999px; background: rgba(20, 26, 38, 0.9); }
.chips button i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--c); box-shadow: 0 0 0 1px rgba(8, 11, 17, 0.6); }
.chips button[aria-pressed="true"] { background: var(--ground-lift); color: var(--paper); border-color: var(--ink-muted); }
.chips button[aria-pressed="false"] { opacity: 0.5; }
.chips button[aria-pressed="false"] i { background: transparent; box-shadow: inset 0 0 0 1.5px var(--c); }
.chips button span { color: var(--ink-muted); font-variant-numeric: tabular-nums; }
button.ghost { background: transparent; color: var(--ink-muted); font-size: var(--t-xs); }
button.ghost:hover { color: var(--paper); }

/* panel */
.panel .tabs { display: flex; margin: 0 0 16px; }
.panel .tabs button { flex: 1; font-size: var(--t-xs); padding: 5px 4px; }
.panel .back { background: none; border: 0; padding: 0; margin: 0 0 12px; color: var(--ink-muted); font-size: var(--t-sm); text-decoration: underline; text-decoration-color: var(--ink-faint); text-underline-offset: 3px; }
.panel .back:hover { color: var(--brass); text-decoration-color: var(--brass); }
.panel h2 .code { color: var(--ink-muted); font-size: var(--t-lg); }
.panel h2 .artno { color: var(--brass); }
.panel h2.act { font-size: var(--t-lg); line-height: 1.25; }
.panel .sub { color: var(--ink-muted); font-size: var(--t-sm); margin: 4px 0 0; line-height: 1.4; }
.panel .heading { font-family: var(--serif); font-size: var(--t-md); color: var(--paper); margin: 6px 0 0; }
.panel .body { font-size: var(--t-sm); color: var(--ink-muted); margin: 8px 0 0; line-height: 1.45; font-style: italic; }
.panel .badge { display: inline-block; font-size: var(--t-xs); padding: 1px 7px; border-radius: 999px; border: 1px solid var(--rule); color: var(--ink-muted); margin-left: 6px; vertical-align: middle; font-family: var(--sans); font-style: normal; }
.panel .badge.warn { border-color: #f87171; color: #fca5a5; }
.panel .intro { margin-top: 4px; }

.kpi { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 16px 0 4px; }
.kpi div { min-width: 0; }
.kpi b { display: block; font-family: var(--serif); font-weight: 500; font-size: 1.45rem; line-height: 1.05; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi span { display: block; font-size: var(--t-xs); color: var(--ink-muted); margin-top: 3px; line-height: 1.3; }
.kpi small { display: block; font-size: 11px; color: var(--ink-faint); line-height: 1.3; margin-top: 2px; }
.kpi b em { font-style: normal; color: var(--ink-faint); font-size: var(--t-sm); }

.stats { display: grid; grid-template-columns: repeat(3, auto); justify-content: space-between; gap: 12px 10px; margin: 16px 0 4px; }
.stats b { display: block; font-family: var(--serif); font-weight: 500; font-size: 1.4rem; line-height: 1.05; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stats span { display: block; font-size: var(--t-xs); color: var(--ink-muted); margin-top: 3px; line-height: 1.3; max-width: 11ch; }

.reach-line { margin: 12px 0 0; font-family: var(--serif); font-size: var(--t-md); line-height: 1.4; }
.reach-line b { color: var(--brass); font-weight: 500; }

/* grupy odesłań w karcie artykułu */
.refgroup { margin: 10px 0 0; font-size: var(--t-sm); }
.refgroup .gh { display: flex; align-items: center; gap: 7px; color: var(--ink-muted); font-size: var(--t-xs); margin-bottom: 4px; }
.refgroup .gh i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.arts { display: flex; flex-wrap: wrap; gap: 4px; }
.arts button { font-size: var(--t-xs); padding: 2px 8px; border-radius: 3px; background: var(--ground-lift); font-variant-numeric: tabular-nums; }
.arts button:hover, .arts button.hot { border-color: var(--brass); color: var(--brass); }
.arts button.dead { text-decoration: line-through; color: var(--ink-faint); }

.exc { list-style: none; margin: 6px 0 0; padding: 0; font-size: var(--t-sm); }
.exc li { padding: 8px 0; border-bottom: 1px solid rgba(36, 45, 61, 0.6); }
.exc .arrow { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.exc .arrow .role { font-size: var(--t-xs); color: var(--ink-faint); }
.exc .arrow .a { font-family: var(--serif); font-weight: 500; }
.exc .arrow .a.me { color: var(--brass); }
.exc .arrow .a.link { cursor: pointer; text-decoration: underline; text-decoration-color: var(--ink-faint); text-underline-offset: 3px; background: none; border: 0; padding: 0; font: inherit; color: inherit; }
.exc .arrow .a.link:hover { color: var(--brass); }
.exc .arrow .to { color: var(--ink-faint); }
.exc blockquote { margin: 5px 0 0; padding: 0 0 0 10px; border-left: 2px solid var(--rule); font-size: var(--t-xs); color: var(--ink-muted); line-height: 1.45; font-style: italic; }

.rows li .k { display: flex; align-items: baseline; gap: 8px; min-width: 0; line-height: 1.3; }
.rows li .k b { font-family: var(--serif); font-weight: 500; white-space: nowrap; }
.rows li .k span { color: var(--ink-muted); font-size: var(--t-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows li.hot, .rows li.hot .k span { color: var(--brass); }
.rows li.click:focus-visible { color: var(--brass); outline-offset: 0; }
.panel .note { font-size: var(--t-xs); color: var(--ink-faint); margin-top: 8px; line-height: 1.45; }
.finding { font-family: var(--serif); font-size: var(--t-md); line-height: 1.45; margin: 12px 0 4px; padding: 10px 12px; border-left: 2px solid var(--brass); background: rgba(20, 26, 38, 0.5); }

/* legenda rodzajów w panelu */
.types-key { list-style: none; margin: 8px 0 0; padding: 0; font-size: var(--t-xs); color: var(--ink-muted); }
.types-key li { display: grid; grid-template-columns: 10px 1fr; gap: 8px; padding: 4px 0; align-items: start; }
.types-key i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-top: 4px; }
.types-key b { color: var(--paper); font-weight: 500; font-family: var(--serif); font-size: var(--t-sm); }
.types-key q { color: var(--ink-muted); }

/* wykresy w panelu */
.chart { width: 100%; height: auto; display: block; margin-top: 8px; overflow: visible; }
.chart text { fill: var(--ink-muted); font-family: var(--sans); font-size: 10px; }
.chart .ax line, .chart .ax path { stroke: var(--rule); }
.chart .grid line { stroke: rgba(36, 45, 61, 0.55); }
.chart .me { fill: none; stroke: var(--paper); stroke-width: 1.8; }
.chart .other { fill: none; stroke: var(--ink-faint); stroke-width: 1; stroke-opacity: 0.8; }
.chart .lab { font-family: var(--serif); font-size: 10.5px; }
.chart .lab.me { fill: var(--paper); stroke: none; }
.chart .lab.other { fill: var(--ink-faint); stroke: none; }
.chart .bar.e { fill: var(--brass); }
.chart .bar.p { fill: var(--ink-muted); fill-opacity: 0.6; }
.chart-key { display: flex; gap: 14px; font-size: var(--t-xs); color: var(--ink-muted); margin-top: 6px; }
.chart-key i { width: 9px; height: 9px; display: inline-block; margin-right: 5px; vertical-align: -1px; }
.chart-key i.e { background: var(--brass); }
.chart-key i.p { background: var(--ink-muted); opacity: 0.6; }
.rank { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; margin-top: 8px; }
.rank h4 { margin: 0 0 4px; font-family: var(--sans); font-weight: 400; font-size: 11px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.04em; }
.rank .rows li { padding: 3px 0; }

@media (max-width: 1100px) {
  .act-title { display: none; }
}
@media (max-width: 900px) {
  .sugg { width: calc(100vw - 40px); }
  .controls { padding: 10px 16px 10px; }
  .kpi { grid-template-columns: 1fr 1fr; }
}
