/* FishLevel — đường độ khó cả bộ level (app/js/ui/packcurve.mjs).
   Mọi màu lấy từ token --fl-* của app.css, LUÔN có giá trị dự phòng sau dấu phẩy để xem / test
   độc lập vẫn ra màu. Đường dùng vector-effect: non-scaling-stroke vì svg preserveAspectRatio="none". */
.pc { display: block; width: 100%; height: auto; font-family: var(--font, system-ui, -apple-system, "Segoe UI", Arial, sans-serif); }
.pc text { font-size: 10px; }
.pc-grid { stroke: var(--fl-line, #e2e7eb); stroke-width: 1; vector-effect: non-scaling-stroke; }
.pc-axis { vector-effect: non-scaling-stroke; }
line.pc-axis { stroke: var(--fl-line-2, #cfd7de); stroke-width: 1; }
text.pc-axis { fill: var(--fl-muted, #62707e); stroke: none; }

/* vùng nền: chuỗi khó (đỏ nhạt) / chuỗi dễ (vàng nhạt) */
.pc-hard { fill: var(--fl-bad, #bb2d24); opacity: .10; }
.pc-easy { fill: var(--fl-amber, #d38a0b); opacity: .14; }
.pc-band { fill: var(--fl-accent, #0f757b); opacity: .18; }

/* đường */
.pc-before { fill: none; stroke: var(--fl-muted, #62707e); stroke-width: 1.4; opacity: .6; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.pc-line-real { fill: none; stroke: var(--fl-accent, #0f757b); stroke-width: 1.8; vector-effect: non-scaling-stroke; }
.pc-line-pred { fill: none; stroke: var(--fl-lock, #7449ac); stroke-width: 1.6; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.pc-line-thin { fill: none; stroke: var(--fl-line-3, #a9b5c0); stroke-width: 1.4; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.pc-roll { fill: none; stroke: var(--fl-ok, #1d7a4c); stroke-width: 1.4; opacity: .75; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }
.pc-ci { stroke: var(--fl-muted, #62707e); stroke-width: 1; opacity: .8; vector-effect: non-scaling-stroke; }

/* điểm */
.pc-pt { stroke: var(--fl-surface, #ffffff); stroke-width: 1; vector-effect: non-scaling-stroke; }
.pc-pt.pc-real { fill: var(--fl-accent, #0f757b); }
.pc-pt.pc-pred { fill: var(--fl-surface, #ffffff); stroke: var(--fl-lock, #7449ac); }
.pc-pt.pc-thin { fill: var(--fl-line-3, #a9b5c0); }
.pc-thin, .pc-outside { opacity: .45; }
.pc-oof { stroke-dasharray: 2 2; }

/* dấu phụ */
.pc-spike { fill: var(--fl-bad, #bb2d24); opacity: .9; }
.pc-unlock { fill: var(--fl-amber, #d38a0b); }
.pc-empty { fill: var(--fl-muted, #62707e); font-size: 12px; }

/* điểm mờ = số thật của revision cũ đã live (level đã sửa sau khi live) · level đổi số (màn Sắp xếp) */
.pc-ghost { fill: none; stroke: var(--fl-accent, #0f757b); stroke-width: 1.2; opacity: .5; stroke-dasharray: 2 2; vector-effect: non-scaling-stroke; }
.pc-pt.pc-moved { stroke: var(--fl-amber, #d38a0b); stroke-width: 2; }
.pc-pt.pc-sel { stroke: var(--fl-ink, #1b2733); stroke-width: 2.4; }

/* chú giải (ui/packchart.mjs legendHtml) */
.pcl-row { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; }
.pcl-item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.pcl { display: inline-block; width: 14px; height: 10px; flex: none; }
.pcl-real { background: radial-gradient(circle, var(--fl-accent, #0f757b) 3px, transparent 3.5px); }
.pcl-pred { background: radial-gradient(circle, var(--fl-surface, #fff) 2px, var(--fl-lock, #7449ac) 2.5px, var(--fl-lock, #7449ac) 3.5px, transparent 4px),
            linear-gradient(color-mix(in srgb, var(--fl-accent, #0f757b) 18%, transparent), color-mix(in srgb, var(--fl-accent, #0f757b) 18%, transparent)); }
.pcl-thin { background: radial-gradient(circle, var(--fl-line-3, #a9b5c0) 3px, transparent 3.5px); opacity: .6; }
.pcl-ghost { border: 1.2px dashed var(--fl-accent, #0f757b); border-radius: 50%; width: 9px; height: 9px; opacity: .6; }
.pcl-roll { border-top: 2px dashed var(--fl-ok, #1d7a4c); height: 0; }
.pcl-before { border-top: 2px dotted var(--fl-muted, #62707e); height: 0; }
.pcl-spike { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 7px solid var(--fl-bad, #bb2d24); }
.pcl-hard { background: color-mix(in srgb, var(--fl-bad, #bb2d24) 14%, transparent); }
.pcl-easy { background: color-mix(in srgb, var(--fl-amber, #d38a0b) 20%, transparent); }
.pcl-unlock { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid var(--fl-amber, #d38a0b); }

/* view Tổng quan bộ (tabs/overview.mjs) */
.ov { display: flex; flex-direction: column; gap: 10px; max-width: 1600px; margin: 0 auto; }
.ov .card { margin: 0; }
.ov-bar { gap: 8px; flex-wrap: wrap; align-items: center; }
.ov-bar select { max-width: min(360px, 60vw); }
.ov-cards { margin-top: 8px; }
.ov-cards .rt-v .bad { color: var(--bad); }
.ov-bot { margin-top: 8px; }
.ov-botrow { gap: 8px; align-items: center; flex-wrap: wrap; }
.ov-prog { flex: 1 1 120px; max-width: 320px; height: 6px; border-radius: 3px; background: var(--fl-sunken, #eef1f4); overflow: hidden; }
.ov-prog i { display: block; height: 100%; background: var(--fl-accent, #0f757b); transition: width .2s; }
.ov-chart { min-height: 160px; }
.ov-range { gap: 6px; align-items: center; flex-wrap: wrap; }
.ov-range input[type=number] { width: 5.5em; }
.ov-range [aria-pressed="true"], .ov-chip[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line, var(--accent)); }
.ov-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 2px; }
.ov-chips:empty { display: none; }
.ov-chip { font-variant-numeric: tabular-nums; }
.ov-chart circle.pc-pt { cursor: pointer; }
.ov-tblwrap { max-height: 60vh; overflow: auto; }
.ov-tbl td { vertical-align: middle; }
.ov-tbl tr.ov-sel td { background: var(--fl-accent-soft, #e3f3f3); }
.ov-tbl .warn { color: var(--warn); }
@media (max-width: 640px) {
  .ov-tbl th:nth-child(5), .ov-tbl td:nth-child(5), .ov-tbl th:nth-child(7), .ov-tbl td:nth-child(7) { display: none; }
}

/* màn Sắp xếp level: đường trước / sau (ui/reorder.mjs) */
.ro-curvebox { margin-top: 8px; padding: 8px 10px; border: 1px solid var(--fl-line, #e2e7eb); border-radius: 8px; background: var(--fl-surface-2, #fafbfc); }
.ro-curvebox .ok { color: var(--ok); }
.ro-curvebox .bad { color: var(--bad); }
.ro-curve { min-height: 120px; margin-top: 4px; }

/* ============================================================================
 * Màu phân loại dùng chung: thẻ "So sánh bộ" (ui/packcompare.mjs — màu theo bộ) + "So sánh nội dung"
 * (ui/livecompare.mjs — màu theo nguyên nhân thua).
 * Bảng màu 4 bộ đã kiểm an toàn cho người mù màu trên nền sáng lẫn tối — giới hạn tối đa 3 bộ vì lý do này.
 * Màu theo BỘ (slot cố định), KHÔNG theo thứ tự đang chọn: bỏ một bộ không đổi màu các bộ còn lại.
 * ==========================================================================*/
:root {
  --fl-cat-1: #2a78d6; --fl-cat-2: #eb6834; --fl-cat-3: #1baf7a; --fl-cat-4: #eda100;
  --fl-cmp-easier: var(--fl-cat-1);
  --fl-cmp-harder: #e34948;
  --fl-cmp-same: var(--fl-line-3);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fl-cat-1: #3987e5; --fl-cat-2: #d95926; --fl-cat-3: #199e70; --fl-cat-4: #c98500;
    --fl-cmp-harder: #e66767;
  }
}
:root[data-theme="dark"] {
  --fl-cat-1: #3987e5; --fl-cat-2: #d95926; --fl-cat-3: #199e70; --fl-cat-4: #c98500;
  --fl-cmp-harder: #e66767;
}

/* ---------- thẻ "So sánh nội dung" ở tab Live (BI): app/js/ui/livecompare.mjs ---------- */
.lc-card { display: flex; flex-direction: column; gap: 12px; }
.lc-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.lc-head h3 { margin: 0; }
.lc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lc-chip { border: 1px solid var(--fl-line-2, #cfd7de); background: var(--fl-surface, #fff); color: var(--fl-ink-2, #384553);
  border-radius: 999px; padding: 3px 10px; font: 500 12.5px var(--font, system-ui, sans-serif); cursor: pointer; }
.lc-chip:hover { border-color: var(--fl-accent, #0f757b); color: var(--fl-accent, #0f757b); }
.lc-chip[aria-pressed="true"] { background: var(--fl-accent-soft, #e2f1f1); border-color: var(--fl-accent, #0f757b); color: var(--fl-ink, #16202a); }
.lc-chip:focus-visible { outline: 2px solid var(--fl-accent, #0f757b); outline-offset: 2px; }
.lc-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--fl-ink-2, #384553); }
.lc-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.lc-legend i.lc-ring { background: transparent !important; border: 2px solid var(--fl-line-3, #a9b5c0); }
.lc-legend i.lc-dash { background: transparent !important; border: 1.5px dashed var(--fl-line-3, #a9b5c0); }
.lc-panel { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.lc-phead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.lc-phead h4 { margin: 0; font-size: 14px; font-weight: 600; }
.lc-note { color: var(--fl-muted, #62707e); font-size: 12.5px; margin: 0; }
.lc-svgbox { overflow-x: auto; min-width: 0; }
.lc-svg { max-width: 100%; height: auto; display: block; font-family: var(--font, system-ui, -apple-system, "Segoe UI", Arial, sans-serif); }
.lc-svg text { fill: var(--fl-muted, #62707e); font-size: 11.5px; }
.lc-svg .lc-grid { stroke: var(--fl-line, #e2e7eb); stroke-width: 1; }
.lc-svg .lc-ink { fill: var(--fl-ink, #16202a); }
.lc-svg .lc-ink2 { fill: var(--fl-ink-2, #384553); }
.lc-hit { cursor: pointer; }
.lc-tblwrap { overflow-x: auto; min-width: 0; }
.lc-tbl { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 13px; }
.lc-tbl th, .lc-tbl td { padding: 6px 10px; border-bottom: 1px solid var(--fl-line, #e2e7eb); text-align: right; white-space: nowrap; }
.lc-tbl th:first-child, .lc-tbl td:first-child { text-align: left; }
.lc-tbl thead th { font-weight: 600; color: var(--fl-ink-2, #384553); font-size: 12px; background: var(--fl-surface-2, #f7f9fa); vertical-align: bottom; }
.lc-tbl th.lc-open { cursor: pointer; }
.lc-tbl th.lc-open:hover { color: var(--fl-accent, #0f757b); }
.lc-tbl .lc-dim { color: var(--fl-faint, #98a3ae); }
.lc-tbl tr.lc-sel td { background: var(--fl-accent-soft, #e2f1f1); }
.lc-role { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.lc-role i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.lc-role small { color: var(--fl-muted, #62707e); font-weight: 400; display: block; font-size: 11px; }
.lc-tbl th > small { display: block; color: var(--fl-muted, #62707e); font-weight: 400; font-size: 11px; }
.lc-pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 1px 8px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.lc-pill.lc-ok { background: var(--fl-ok-soft, #e2f3e9); color: var(--fl-ok, #1d7a4c); }
.lc-pill.lc-bad { background: var(--fl-bad-soft, #fce8e6); color: var(--fl-bad, #bb2d24); }
.lc-pill.lc-neu { background: var(--fl-sunken, #edf1f4); color: var(--fl-ink-2, #384553); }
.lc-pill.lc-weak { background: transparent; color: var(--fl-muted, #62707e); border: 1px dashed var(--fl-line-3, #a9b5c0); font-weight: 500; }

/* ---------- thẻ "So sánh bộ" ở Tổng quan bộ: app/js/ui/packcompare.mjs ---------- */
.ovc { display: grid; gap: 18px; min-width: 0; }
.ovc-panel { display: grid; gap: 6px; min-width: 0; }
.ovc-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.ovc-head h3 { margin: 0; }
.ovc-svg { display: block; width: 100%; height: auto; font-family: var(--font, system-ui, -apple-system, "Segoe UI", Arial, sans-serif); }
.ovc-svg-narrow { max-width: 560px; }
.ovc-svg text { font-size: 11px; fill: var(--fl-muted, #62707e); }
.ovc-svg .ovc-ink { fill: var(--fl-ink, #16202a); }
.ovc-svg .ovc-ink2 { fill: var(--fl-ink-2, #384553); }
.ovc-svg .ovc-grid { stroke: var(--fl-line, #e2e7eb); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ovc-svg .ovc-axis { stroke: var(--fl-line-3, #a9b5c0); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ovc-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--fl-ink-2, #384553); }
.ovc-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.ovc-legend i.bar { width: 14px; height: 8px; border-radius: 2px; }
.ovc-legend i.ring { background: transparent !important; border: 2px solid var(--fl-line-3, #a9b5c0); }
.ovc-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 2px; }
.ovc-chips:empty { display: none; }
.ovc-chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--fl-line-2, #cfd7de); background: var(--fl-surface, #fff); color: var(--fl-ink-2, #384553); border-radius: 999px; padding: 3px 10px; font: 500 12.5px var(--font, sans-serif); }
.ovc-chip i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.ovc-chip small { color: var(--fl-muted, #62707e); font-weight: 400; }
.ovc-plat { font: 500 11.5px var(--font, sans-serif); color: var(--fl-ink-2, #384553); background: transparent; border: 1px solid var(--fl-line, #e2e7eb); border-radius: 999px; padding: 0 4px; margin-left: 4px; }
.ovc-x { border: 0; background: transparent; color: var(--fl-muted, #62707e); cursor: pointer; font: inherit; line-height: 1; padding: 0 0 0 2px; }
.ovc-x:hover { color: var(--fl-bad, #bb2d24); }
.ovc-add, .ovc-selects select { font: 500 12.5px var(--font, sans-serif); color: var(--fl-ink, #16202a); background: var(--fl-surface, #fff); border: 1px solid var(--fl-line-2, #cfd7de); border-radius: 6px; padding: 3px 6px; }
.ovc-add:disabled { opacity: .55; cursor: not-allowed; }
.ovc-selects { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ovc-selects label { color: var(--fl-muted, #62707e); font-size: 12.5px; }
.ovc-tblwrap { overflow-x: auto; min-width: 0; }
.ovc-tbl { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 13px; }
.ovc-tbl th, .ovc-tbl td { padding: 6px 10px; border-bottom: 1px solid var(--fl-line, #e2e7eb); text-align: right; white-space: nowrap; }
.ovc-tbl th:first-child, .ovc-tbl td:first-child { text-align: left; }
.ovc-tbl thead th { font-weight: 600; color: var(--fl-ink-2, #384553); font-size: 12px; background: var(--fl-surface-2, #f7f9fa); }
.ovc-tbl .ovc-role { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.ovc-tbl .ovc-role i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.ovc-tbl .muted { color: var(--fl-muted, #62707e); }
.ovc-empty { color: var(--fl-muted, #62707e); font-size: 13px; }
.ov-cmpcard .ovc-chips { margin-bottom: 8px; }
