:root {
  --ink: #1d1d1f;
  --muted: #6b6b72;
  --line: #dcdce1;
  --bg: #f4f4f6;
  --panel: #ffffff;
  --ref: #222222;
  --cand: #E69F00;
  --sync: #0072B2;
  --naive: #D55E00;
  --inpaint: #009E73;
  --seam: #c2185b;
  --font: "Inter", "Ubuntu Sans", "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 12px; }
button, select { font-family: inherit; font-size: 12px; }
button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 4px 10px; cursor: pointer; }
button:hover { border-color: #999; }
button.icon { padding: 3px 8px; font-size: 14px; }
button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

#topbar { height: 48px; display: flex; align-items: center; gap: 24px; padding: 0 14px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.logo { font-size: 20px; font-weight: 800; letter-spacing: -0.4px; }
.subtitle { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pickers { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.chip { display: inline-flex; align-items: center; gap: 4px; border: 2px solid; border-radius: 16px; padding: 2px 4px 2px 10px; font-weight: 700; }
.chip select { border: none; background: transparent; font-weight: 600; cursor: pointer; }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.chip.ref { border-color: var(--ref); } .chip.ref .dot { background: var(--ref); }
.chip.cand { border-color: var(--cand); } .chip.cand .dot { background: var(--cand); }
.actions { display: flex; gap: 6px; }

#app {
  height: calc(100vh - 48px); min-height: 760px; padding: 10px; display: grid; gap: 10px;
  grid-template-columns: minmax(520px, 45fr) minmax(600px, 55fr);
}
.col { display: flex; flex-direction: column; gap: 10px; min-height: 0; min-width: 0; }
#pA { flex: 37 1 0; } #pB { flex: 63 1 0; }
#pC { flex: 54 1 0; } #pD { flex: 46 1 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.ph { padding: 8px 12px 2px; font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.pl { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; background: var(--ink); color: #fff; font-size: 11px; }
.task { font-weight: 500; color: var(--muted); font-size: 11px; }
.seedlabel { margin-left: auto; font-weight: 600; color: var(--muted); }
.controls { padding: 4px 12px 0; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; color: var(--muted); }
.controls .seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.controls .seg button { border: none; border-radius: 0; padding: 2px 7px; border-right: 1px solid var(--line); }
.controls .seg button:last-child { border-right: none; }
.controls select { border: 1px solid var(--line); border-radius: 5px; padding: 1px 3px; }
.body { flex: 1; min-height: 0; position: relative; }
.body svg { display: block; }
.player { display: flex; align-items: center; gap: 8px; padding: 2px 10px 6px; }
.player input[type=range] { flex: 1; accent-color: var(--ink); }
.player .tval { font-variant-numeric: tabular-nums; min-width: 128px; color: var(--muted); }

.tooltip { position: fixed; pointer-events: none; z-index: 20; background: rgba(29,29,31,0.94); color: #fff; padding: 6px 8px; border-radius: 6px; font-size: 11.5px; line-height: 1.45; max-width: 300px; box-shadow: 0 2px 10px rgba(0,0,0,0.2); }
.tooltip b { color: #fff; }
.tooltip .k { color: #c9c9cf; }

.axis text { fill: var(--muted); font-size: 10px; }
.axis path, .axis line { stroke: #b9b9c0; }
.axis-title { fill: var(--muted); font-size: 10.5px; }
.gridline line { stroke: #ececf0; }
.muted { color: var(--muted); }
.hint { fill: var(--muted); font-size: 10.5px; font-style: italic; }

[hidden] { display: none !important; }
.guide { position: fixed; inset: 0; background: rgba(20,20,24,0.45); display: grid; place-items: center; z-index: 30; }
.guide-card { background: #fff; border-radius: 12px; padding: 22px 26px; width: min(720px, 92vw); font-size: 13.5px; line-height: 1.5; box-shadow: 0 10px 40px rgba(0,0,0,0.3); }
.guide-card h2 { margin: 0 0 8px; }
.guide-card ol { padding-left: 20px; } .guide-card li { margin: 4px 0; }
.guide-card button { margin-top: 6px; background: var(--ink); color: #fff; border-color: var(--ink); padding: 6px 14px; font-size: 13px; }
.tR { font-weight: 700; color: var(--ref); } .tC { font-weight: 700; color: #b77b00; }
.tS, .tN, .tI, .tSeam { font-weight: 700; }
.tS::before, .tN::before, .tI::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 3px; vertical-align: 0; }
.tS::before { background: var(--sync); border-radius: 50%; } .tN::before { background: var(--naive); } .tI::before { background: var(--inpaint); transform: rotate(45deg) scale(0.85); }
.tSeam { color: var(--seam); }
.note { padding: 2px 10px 6px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.note b { color: var(--ink); }
.note.key { display: flex; flex-wrap: wrap; gap: 2px 14px; }
.note.key.top { padding-top: 0; padding-bottom: 0; }
.note.key i { display: inline-block; width: 18px; height: 8px; margin-right: 4px; vertical-align: 0; }
.k-line { border-top: 2.6px solid #777; transform: translateY(3px); }
.k-dash { border-top: 1.4px dashed #777; transform: translateY(3px); }
.k-dot { border-top: 2px dotted #9a9aa2; transform: translateY(3px); }
.k-seam { border-top: 2.4px solid var(--seam); transform: translateY(3px); }
.k-hatch { width: 12px !important; background: repeating-linear-gradient(45deg, #a9a9b1 0 1.2px, transparent 1.2px 3px); }
.k-lolli { width: 6px !important; height: 11px !important; border-left: 1.2px solid var(--seam); position: relative; margin-left: 3px; }
.k-lolli::before { content: ""; position: absolute; left: -3.2px; top: -2px; width: 4px; height: 4px; border-radius: 50%; background: var(--seam); }
.controls .legend { display: inline-flex; gap: 10px; margin-left: auto; }
.controls .legend .li { display: inline-flex; align-items: center; gap: 3px; color: var(--ink); cursor: default; }
.brush .selection { fill: #1d1d1f; fill-opacity: 0.06; stroke: #1d1d1f; stroke-opacity: 0.5; stroke-dasharray: 4 3; }
