/* Narzedzia: PoE2 Regex Builder i Economy.
   Ladowane tylko na stronach narzedzi, na wierzchu style.css (te same tokeny).
   Kolory semantyczne (wzrost/spadek, chce/unikam) sa osobne od akcentu. */

.tool-page { --up: #7fb069; --down: #d0685c; }
.topbar nav a[aria-current="page"] { color: var(--title); }
.tool-hero { padding: 44px 0 20px; }
.tool-hero h1 { font-size: clamp(30px, 4vw, 42px); line-height: 1.15; margin: 0 0 12px;
                color: var(--title); text-wrap: balance; }
.tool-hero .lead { margin-bottom: 0; }
.tool { padding: 12px 0 56px; }
.note.small, .small { font-size: 13px; }

.tool-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }
@media (max-width: 900px) { .tool-grid { grid-template-columns: 1fr; } }

.tool-tabs, .chips, .game-switch {
  display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; margin-bottom: 18px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 11px;
}
.tool-tabs button, .chips button, .game-switch a {
  appearance: none; background: none; border: 0; border-radius: 8px; cursor: pointer;
  color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; padding: 7px 16px;
}
.tool-tabs button:hover, .chips button:hover, .game-switch a:hover { color: var(--fg); }
.tool-tabs [aria-selected="true"], .chips [aria-selected="true"], .game-switch a.on {
  color: var(--title); background: var(--raise); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}

.tool-panel .note { margin-top: 0; }
.sub { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
       margin: 22px 0 10px; }
.list-tools { display: flex; align-items: center; gap: 14px; margin: 6px 0 10px; }
.filter, #econ-search, .field-inline select, .thr input[type="number"] {
  background: var(--bg); color: var(--fg); border: 1px solid var(--border); border-radius: 8px;
  font: inherit; font-size: 14px; padding: 8px 12px;
}
.filter { flex: 1; max-width: 360px; }
.filter:focus, #econ-search:focus, .field-inline select:focus, .thr input:focus {
  outline: none; border-color: var(--accent);
}
.picked { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.mods { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border);
        border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.mods li { display: flex; align-items: center; gap: 12px; justify-content: space-between;
           padding: 7px 10px 7px 14px; border-top: 1px solid var(--border); font-size: 14.5px; }
.mods li:first-child { border-top: 0; }
.mods li:hover { background: var(--raise); }
.mods li[data-state="want"] { background: rgba(127, 176, 105, .10); box-shadow: inset 3px 0 0 var(--up); }
.mods li[data-state="avoid"] { background: rgba(208, 104, 92, .10); box-shadow: inset 3px 0 0 var(--down); }
.mods li[data-state="avoid"] .mod-text { color: var(--muted); text-decoration: line-through;
                                         text-decoration-color: rgba(208, 104, 92, .6); }
.also { color: var(--muted); font-size: 12px; margin-left: 4px; }
.seg { display: inline-flex; flex: none; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.seg button { appearance: none; background: var(--bg); color: var(--muted); border: 0; cursor: pointer;
              font: inherit; font-size: 12.5px; font-weight: 600; padding: 4px 10px; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button:hover { color: var(--fg); }
.seg button[data-set="want"][aria-pressed="true"] { background: var(--up); color: #14110d; }
.seg button[data-set="avoid"][aria-pressed="true"] { background: var(--down); color: #14110d; }

.thresholds { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.thr { display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer;
       background: var(--panel); border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.thr.on { border-color: var(--accent); }
.thr span { flex: 1; }
.thr input[type="number"] { width: 74px; padding: 5px 8px; text-align: right; font-variant-numeric: tabular-nums; }
.thr input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

.tool-out { position: sticky; top: 76px; }
@media (max-width: 900px) { .tool-out { position: static; order: -1; } }
.out-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.out-head { display: flex; align-items: baseline; justify-content: space-between; }
.out-head h2 { font-size: 17px; margin: 0 0 10px; color: var(--title); }
.counter { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.counter b { color: var(--fg); }
.counter.over, .counter.over b { color: var(--down); }
#regex-out { width: 100%; resize: vertical; min-height: 110px; background: var(--bg); color: var(--title);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  font: 13.5px/1.55 ui-monospace, "Cascadia Mono", Consolas, monospace; word-break: break-all; }
.out-actions { display: flex; gap: 10px; margin: 12px 0 14px; }
.out-actions .btn { padding: 9px 18px; font-size: 14px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; }
.mode { border: 0; padding: 0; margin: 0 0 8px; font-size: 14px; }
.mode legend { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.mode label { margin-right: 14px; cursor: pointer; }
.mode input { accent-color: var(--accent); }

.how { padding-left: 20px; }
.how li { margin-bottom: 8px; }
.tool-page code { background: var(--panel); border: 1px solid var(--border); border-radius: 5px;
                  padding: 1px 6px; font: 13.5px ui-monospace, Consolas, monospace; color: var(--title); }

/* economy */
.econ-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-bottom: 4px; }
.econ-bar .game-switch { margin-bottom: 0; }
.field-inline { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
#econ-search { min-width: 220px; width: 17em; max-width: 100%; }
.rates { margin: 0 0 0 auto; color: var(--title); font-size: 14px; font-variant-numeric: tabular-nums; }
.econ .chips { margin: 14px 0 12px; }
.econ-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.econ-table { width: 100%; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.econ-table th, .econ-table td { padding: 9px 14px; text-align: left; border-top: 1px solid var(--border); white-space: nowrap; }
.econ-table thead th { border-top: 0; color: var(--muted); font-size: 12px; letter-spacing: .06em;
                       text-transform: uppercase; font-weight: 700; background: var(--panel); }
.econ-table thead th[data-sort] { cursor: pointer; user-select: none; }
.econ-table thead th[data-sort]:hover { color: var(--fg); }
.econ-table thead th[aria-sort="ascending"]::after { content: " \25B2"; font-size: 9px; }
.econ-table thead th[aria-sort="descending"]::after { content: " \25BC"; font-size: 9px; }
.econ-table .col-n { text-align: right; }
.econ-table tbody tr:hover { background: var(--raise); }
.econ-table tbody th { font-weight: 500; color: var(--fg); }
.econ-table .item { display: inline-flex; align-items: center; gap: 10px; }
.econ-table .item img { width: 28px; height: 28px; object-fit: contain; }
.econ-table td b { color: var(--title); font-weight: 600; }
.econ-table td small { display: block; color: var(--muted); font-size: 12px; }
.econ-table .muted { color: var(--muted); }
.chg.up { color: var(--up); }
.chg.down { color: var(--down); }
.chg.flat, .chg.none { color: var(--muted); }
.spark-col { width: 110px; }
.spark polyline { stroke-width: 1.6; }
.spark.up polyline { stroke: var(--up); }
.spark.up circle { fill: var(--up); }
.spark.down polyline { stroke: var(--down); }
.spark.down circle { fill: var(--down); }
.spark.flat polyline { stroke: var(--muted); }
.spark.flat circle { fill: var(--muted); }

/* economy: unikaty, wiersz szczegolow i wykres historii */
.econ-table tbody tr.row { cursor: pointer; }
.econ-table tbody tr.row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.econ-table tbody tr[aria-expanded="true"] { background: var(--raise); }
.econ-table .item small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.econ-table .item .lowtag { color: var(--down); }
.econ-table tr.low th, .econ-table tr.low td { opacity: .72; }
.econ-table tr.detail td { padding: 0; background: var(--bg); white-space: normal; }
.econ-table tr.detail:hover { background: var(--bg); }
.detail-box { padding: 18px 20px 16px; }
.detail-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; }
.detail-head h3 { margin: 0; font-size: 16px; color: var(--title); }
.detail-stats { display: flex; flex-wrap: wrap; gap: 6px 26px; margin: 0; }
.detail-stats div { display: flex; flex-direction: column; }
.detail-stats dt { color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.detail-stats dd { margin: 0; color: var(--fg); font-size: 15px; font-variant-numeric: tabular-nums; }
.chart-wrap { position: relative; margin-top: 12px; }
.hist { display: block; max-width: 100%; height: auto; }
.hist .gl { stroke: var(--border); stroke-width: 1; }
.hist .axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.hist .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.hist .area { fill: var(--accent); opacity: .10; }
.hist .dot-end, .hist .dot-hover { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }
.hist .cross { stroke: var(--muted); stroke-width: 1; }
.hist .hit { fill: transparent; cursor: crosshair; }
.tip { position: absolute; transform: translate(-50%, -100%); pointer-events: none; white-space: nowrap;
       background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 5px 9px;
       font-size: 12px; box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .7); }
.tip b { color: var(--title); margin-right: 8px; font-variant-numeric: tabular-nums; }
.tip span { color: var(--muted); }
.tool-page details.data-table { margin-top: 10px; border: 0; padding: 0; background: none; }
.tool-page .data-table summary { font-size: 13px; font-weight: 500; color: var(--muted); }
.tool-page .data-table summary::before { content: none; }
.data-table table { margin-top: 8px; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 3px 14px 3px 0; border: 0; text-align: left; }
.data-table .col-n { text-align: right; }

/* instill */
.instill-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; margin-bottom: 22px; }
.instill .out-card h2 { font-size: 17px; margin: 0 0 12px; color: var(--title); }
.slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.slot { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px;
        letter-spacing: .06em; text-transform: uppercase; }
.slot select { background: var(--bg); color: var(--fg); border: 1px solid var(--border); border-radius: 8px;
               font: inherit; font-size: 14px; letter-spacing: 0; text-transform: none; padding: 8px 10px; }
.slot select:focus { outline: none; border-color: var(--accent); }
.combo-result { margin-top: 14px; min-height: 64px; }
.combo-result .notable { border-color: var(--accent); }
.filter.wide { max-width: none; width: 100%; }
.owned { display: flex; flex-wrap: wrap; gap: 6px; }
.emo { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); border-radius: 999px;
       padding: 2px 10px; font-size: 12.5px; color: var(--fg); background: var(--bg); white-space: nowrap; }
.emo i { font-style: normal; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.emo.t0 { border-color: #4a4232; color: var(--muted); }
.emo.t1 { border-color: #6d5d3c; }
.emo.t2 { border-color: var(--accent); color: var(--title); }
.emo.t3 { border-color: var(--accent-hi); color: var(--title); font-weight: 600; box-shadow: inset 0 0 0 1px rgba(230, 189, 58, .35); }
button.emo { cursor: pointer; font: inherit; font-size: 12.5px; }
button.emo[aria-pressed="true"] { background: var(--raise); box-shadow: inset 0 0 0 1px var(--accent); color: var(--title); }
.instill .sub { margin: 14px 0 8px; }
.nt-count { margin: 0 0 10px; font-variant-numeric: tabular-nums; }
.notables { list-style: none; margin: 0; padding: 0; display: grid;
            grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 10px; }
.notable { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
           padding: 12px 14px; cursor: pointer; }
.notable:hover { border-color: var(--muted); }
.nt-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
.nt-head h3 { margin: 0; font-size: 15px; color: var(--title); }
.recipe { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.nt-stats { margin: 8px 0 0; padding-left: 18px; color: var(--fg); font-size: 13.5px; }
.nt-stats li { margin: 1px 0; }
@media (max-width: 520px) { .notables { grid-template-columns: 1fr; } .slots { grid-template-columns: 1fr; } }

/* economy: wyszukiwanie we wszystkich kategoriach */
.econ .chips.dimmed button[aria-selected="true"] { background: none; box-shadow: none; color: var(--muted); }
.econ-table .item .cat { appearance: none; border: 1px solid var(--border); background: var(--bg); color: var(--muted);
  border-radius: 999px; font: inherit; font-size: 11px; font-weight: 600; padding: 0 8px; margin-left: 8px;
  vertical-align: 2px; cursor: pointer; }
.econ-table .item .cat:hover { color: var(--title); border-color: var(--accent); }

/* map regex: szybkie zestawy i znacznik T17 */
.presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px; }
.presets span { color: var(--muted); font-size: 13px; margin-right: 4px; }
.presets button { appearance: none; border: 1px solid var(--border); background: var(--bg); color: var(--fg);
  border-radius: 999px; font: inherit; font-size: 13px; padding: 3px 12px; cursor: pointer; }
.presets button:hover { border-color: var(--down); color: var(--title); }
.presets button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tag-t17 { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 4px; padding: 0 5px; margin-left: 6px; vertical-align: 1px; }
.list-tools .field-inline { white-space: nowrap; font-size: 13px; color: var(--muted); }

/* PoE1 regex: gniazda w zakladce Vendor, liczniki grup */
.sockets { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--panel); }
.sockets.on { border-color: var(--accent); }
.sockets select, .sock-colour input { background: var(--bg); color: var(--fg); border: 1px solid var(--border);
  border-radius: 7px; font: inherit; padding: 5px 8px; }
.sock-colour { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.sock-colour input { width: 58px; text-align: right; font-variant-numeric: tabular-nums; }
.sock-colour span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 6px; vertical-align: 0; background: currentColor; }
.sock-colour.r span::before { color: #c8553d; }
.sock-colour.g span::before { color: #6aa84f; }
.sock-colour.b span::before { color: #4f7fc8; }
.sockets .note { flex-basis: 100%; margin: 0; }
.sub .count { color: var(--muted); font-weight: 400; letter-spacing: 0; margin-left: 4px; }
.out-actions { flex-wrap: wrap; }
