/* Sketch Library - stylesheet (2026-09-09). */

:root {
  --head-h: 96px;
  --ink: #1c1a17;
  --muted: #6b665e;
  --line: #e3ddd2;
  --paper: #faf8f4;
  --card: #ffffff;
  --accent: #3b5bdb;
  --accent-soft: #e8edfb;
  --red: #d92b2b;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
code { font: 12px/1.4 ui-monospace, Consolas, monospace; background: #f1ede6; padding: 1px 4px; border-radius: 3px; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.topbar-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px;
  padding: 10px 18px;
}
.brand h1 { margin: 0; font-size: 19px; line-height: 1.2; letter-spacing: .01em; }
.brand .count { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }

.topbar-tools {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-left: auto;
}
.searchwrap input {
  width: 100%;
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px;
  background: #fff;
}
.searchwrap input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.sortwrap { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.sortwrap select {
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: #fff;
}
.btn-clear, .btn-more, .sidebar-toggle {
  padding: 6px 11px; border: 1px solid var(--line); border-radius: 7px;
  background: #fff; cursor: pointer;
}
.btn-clear:hover, .btn-more:hover, .sidebar-toggle:hover { border-color: var(--accent); color: var(--accent); }

.btn-draw {
  padding: 6px 11px; border: 1px solid var(--ink); border-radius: 7px;
  background: var(--ink); color: #fff; cursor: pointer;
}
.btn-draw:hover { background: #000; }

.chipbar {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 18px 10px;
}
.chip.drawn { border-color: var(--red); background: #fbe9e9; color: #8f2a22; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border: 1px solid var(--accent); border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 12.5px; cursor: pointer;
}
.chip b { font-weight: 600; }
.chip .x { font-size: 15px; line-height: 1; }

/* ---------- layout ---------- */

.layout { display: flex; align-items: flex-start; }

.sidebar {
  position: sticky; top: var(--head-h);
  flex: 0 0 340px; max-height: calc(100vh - var(--head-h));
  overflow-y: auto;
  padding: 12px 12px 30px 18px;
  border-right: 1px solid var(--line);
  background: var(--paper);
}
.sidebar.collapsed { flex-basis: 78px; }
.sidebar.collapsed .facets { display: none; }
.sidebar-toggle { width: 100%; margin-bottom: 10px; text-align: left; font-weight: 600; }

.content { flex: 1 1 auto; min-width: 0; padding: 16px 18px 40px; }

/* ---------- facets ---------- */

.facet { border-bottom: 1px solid var(--line); padding: 4px 0 8px; }
.facet-head {
  display: flex; align-items: center; gap: 7px; width: 100%;
  padding: 6px 0; border: 0; background: none; text-align: left;
  font-weight: 600; cursor: pointer;
}
.facet-head .caret { font-size: 9px; color: var(--muted); width: 10px; }
.facet-head .n { margin-left: auto; font-size: 11.5px; font-weight: 400; color: var(--accent); }
.facet.collapsed .facet-body { display: none; }
.facet-body { max-height: 260px; overflow-y: auto; padding-left: 2px; }

.opt {
  display: flex; align-items: center; gap: 7px;
  padding: 2px 0; font-size: 13px; cursor: pointer;
}
.opt input { margin: 0; }
.opt .lbl { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt .cnt { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.opt.zero { opacity: .42; }
.exmark { color: #b4423a; font-size: 11px; }

/* ---------- body map ---------- */

.bodymap-wrap { margin-bottom: 4px; }
/* the whole figure stays in view, head to ankle, with no inner scrolling */
.bodymap-body { max-height: none; overflow: visible; }
.bm-stage { position: relative; }
#bodymap { width: 100%; max-width: 240px; height: auto; display: block; }
.bm-region { fill: #fff; stroke: none; cursor: pointer; transition: fill .12s; }
.bm-region:hover { fill: var(--accent-soft); }
.bm-region.active { fill: #b9c7f5; }
.bm-outline { fill: none; stroke: var(--ink); stroke-width: 1.4; pointer-events: none; }
.bm-marks line { stroke: #b8b0a4; stroke-width: .8; stroke-dasharray: 3 3; pointer-events: none; }
.bm-marks text, .bm-waist text, .bm-shoulder text { font-size: 8.5px; fill: var(--muted); pointer-events: none; }
.bm-waist line { stroke: #b4423a; stroke-width: 1; pointer-events: none; }
.bm-waist text { fill: #b4423a; }
.bm-shoulder circle { fill: #b4423a; pointer-events: none; }
.bm-tip {
  position: absolute; left: 6px; bottom: 6px; right: 6px;
  padding: 6px 8px; border-radius: 6px;
  background: var(--ink); color: #fff; font-size: 11.5px; line-height: 1.35;
  pointer-events: none;
}
.bm-tip b { display: block; }
.bm-rel { margin-top: 8px; }
.bm-rel-lbl { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.bm-relbtns { display: flex; flex-wrap: wrap; gap: 4px; }
.bm-relbtn {
  padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; font-size: 12px; cursor: pointer;
}
.bm-relbtn:hover { border-color: var(--accent); }
.bm-relbtn.active { background: #b9c7f5; border-color: var(--accent); }
.bm-cap { margin: 8px 0 0; font-size: 11px; color: var(--muted); }

/* ---------- cards ---------- */

.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.card {
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; cursor: pointer;
  transition: box-shadow .12s, border-color .12s;
}
.card:hover { border-color: #c9c1b3; box-shadow: 0 3px 14px rgba(0, 0, 0, .08); }
/* the left half of the photo: the garment with the sketch on it */
.thumb {
  position: relative; aspect-ratio: 2 / 3; background: #f1ede6;
  overflow: hidden;
}
.thumb img { width: 200%; max-width: none; height: 100%; object-fit: fill; display: block; }
.thumb.side-r img { margin-left: -100%; }
.thumb.full img { width: 100%; }
.thumb canvas.hl { position: absolute; left: 0; top: 0; pointer-events: none; }
.thumb.missing { display: flex; align-items: center; justify-content: center; }
.thumb.missing::after { content: "no image"; color: var(--muted); font-size: 12px; }
.card-body { padding: 9px 11px 11px; display: flex; flex-direction: column; gap: 6px; }
.card-id { display: flex; justify-content: space-between; font-weight: 600; font-size: 13px; }
.card-id .ses { color: var(--muted); font-weight: 400; font-size: 12px; }
.card-final { font-size: 13px; line-height: 1.4; }
.card-final.fallback { color: var(--muted); font-style: italic; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.tag {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  font-size: 11.5px; line-height: 1.5;
  background: #eeeae2; color: var(--ink);
}
.tag.act { background: var(--accent-soft); color: #2846b8; }
.tag.zone { background: #efe3f8; color: #6b3a9a; }
.tag.loc { background: #e2f1e6; color: #24683a; }
.tag.shape { background: #fbeedd; color: #8a4f0f; }
.tag.diff { background: #f3f0ea; color: var(--muted); }
.tag.lshape { background: #fff; border: 1px solid var(--line); display: inline-flex; align-items: center; gap: 5px; }
.opt .sw { flex: 0 0 auto; }
.tag.grp-Novice { background: #e6f0f7; color: #245b85; }
.tag.grp-Expert { background: #fbe4e8; color: #963142; }

.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.badge {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .03em;
  background: #eee; color: #444;
}
.badge.excluded { background: #f8dcd9; color: #8f2a22; }
.badge.omitted { background: #f3e2c4; color: #7a4d05; }
.badge.scopeout { background: #e9e3d6; color: #5c5040; }
.badge.redraw { background: #ddebf6; color: #234c74; }
.badge.unverified { background: #f6e9c8; color: #6f5000; }
.badge.backfilled { background: #e6e6f5; color: #3e3e8a; }
.badge.verified { background: #dcefdf; color: #1f5f2c; }
.badge.nomark { background: #eee; color: #666; }

/* ---------- session view ---------- */

.grid.as-sessions { display: block; }
.session { margin-bottom: 22px; }
.session-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 14px;
}
.session-head .muted { color: var(--muted); font-size: 12.5px; }
.session-text { max-width: 92ch; margin: 0 0 10px; }
.session-text p { margin: 6px 0 0; font-size: 13.5px; line-height: 1.5; }
.tag.strat { background: #efe9dc; color: #5a4a2a; }
.session-strip {
  display: flex; gap: 12px; align-items: flex-start;
  overflow-x: auto; padding: 2px 2px 10px;
}
.session-strip .card { flex: 0 0 210px; }
.session-target { flex: 0 0 130px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.session-target .thumb { width: 100%; border-radius: 10px; }
.session-target .tcap { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

.empty, .nodata { color: var(--muted); }
.loadmore-wrap { text-align: center; margin: 18px 0; }
.sentinel { height: 1px; }

/* ---------- modal ---------- */

.modal { position: fixed; inset: 0; z-index: 50; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(20, 16, 10, .55); }
.modal-panel {
  position: absolute; inset: 2vh 2vw;
  display: flex; flex-direction: column;
  background: #fff; border-radius: 12px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
}
.modal-title h2 { margin: 0 0 2px; font-size: 17px; }
.modal-title .sub { color: var(--muted); font-size: 13px; }
.modal-nav { display: flex; align-items: center; gap: 6px; }
.modal-nav .pos { color: var(--muted); font-size: 12.5px; margin-right: 6px; }
.modal-nav button {
  width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 7px;
  background: #fff; cursor: pointer; font-size: 16px;
}
.modal-nav button:hover { border-color: var(--accent); color: var(--accent); }

.modal-body { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }

/* three viewports on black: the image pair, the playback, the still */
.visuals {
  display: flex; flex: 0 0 52%; min-height: 0;
  background: #000; border-bottom: 1px solid var(--line);
}
.viewport {
  flex: 1 1 0; min-width: 0; min-height: 0;
  display: flex; flex-direction: column; background: #000;
}
.viewport.pair { flex: 2 1 0; }
.viewport + .viewport { border-left: 1px solid #222; }
.pane-cap {
  flex: 0 0 auto; padding: 8px 12px 2px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
.viewport .pane-cap { color: #9a948a; }
.pane-hint { text-transform: none; letter-spacing: 0; margin-left: 8px; color: #a39c90; }
.timebar {
  display: inline-block; width: 70px; height: 8px; vertical-align: -1px; border-radius: 2px;
  background: linear-gradient(90deg, rgb(25,30,110), rgb(0,130,255), rgb(50,230,190), rgb(255,220,40), rgb(255,45,20));
}
.stage {
  flex: 1 1 auto; min-width: 0; min-height: 0; position: relative;
  display: flex; align-items: center; justify-content: center;
  background: #000; padding: 8px;
}
.stage img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.stage canvas { display: block; background: #000; }
#playStage canvas { cursor: pointer; }
.play-msg {
  position: absolute; left: 16px; right: 16px; top: 50%; transform: translateY(-50%);
  padding: 10px 12px; border-radius: 8px;
  background: rgba(30, 28, 26, .95); border: 1px solid #444;
  font-size: 12.5px; text-align: center; color: #ccc;
}
.play-msg.err { color: #f0a49c; border-color: #7a3a33; }

.playbar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap;
  padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--paper);
}
.legend { flex: 1 1 320px; }
.lab.dim { opacity: .38; }
.lab.hit { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.playbar .play-note { flex: 1 1 100%; padding: 0; }

.transport {
  flex: 0 0 auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.transport button {
  height: 28px; min-width: 28px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer;
  font-size: 13px;
}
.transport button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.transport button:disabled { opacity: .4; cursor: default; }
.transport .playbtn { background: var(--red); color: #fff; border-color: var(--red); min-width: 36px; }
.transport .playbtn:hover:not(:disabled) { color: #fff; filter: brightness(1.08); }
.transport .scrub { flex: 1 1 120px; min-width: 80px; accent-color: var(--red); }
.transport .readout { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.transport .speeds { display: flex; gap: 2px; }
.transport .speeds button { min-width: 0; padding: 0 6px; font-size: 11.5px; }
.transport .speeds button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.play-note { flex: 0 0 auto; margin: 0; padding: 0 12px 8px; font-size: 11px; color: #a39c90; }

/* the detail sections sit side by side, each as wide as it needs */
.modal-meta {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px 18px 30px;
  display: flex; flex-wrap: wrap; align-items: flex-start; align-content: flex-start; gap: 18px 32px;
}
.modal-meta .sect { flex: 0 1 auto; min-width: 0; max-width: 46ch; margin: 0; }
.modal-meta .sect:has(.tbl) { max-width: 100%; overflow-x: auto; }
.modal-meta .kv { grid-template-columns: max-content 1fr; }
.modal-meta .tbl { width: auto; }

/* labeler reading chips (record view and draw panel) */
.labs { display: flex; flex-wrap: wrap; gap: 6px; }
.lab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 8px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; font-size: 13px;
}
.lab em { font-style: normal; color: var(--muted); }
.lab small { color: #a39c90; font-size: 11px; margin-left: 2px; }
.sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; flex: 0 0 auto; }

/* ---------- the search panel: words, a drawing, the body map ---------- */

.searchpanel { display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.drawbox { display: flex; flex-direction: column; gap: 7px; }
.drawbox .pane-cap { padding: 0; }
.drawbox canvas {
  width: 100%; height: auto; display: block;
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
  touch-action: none; cursor: crosshair;
}
.draw-tools { display: flex; gap: 5px; flex-wrap: wrap; }
.draw-tools button, .btn-primary {
  padding: 5px 10px; border: 1px solid var(--line); border-radius: 7px;
  background: #fff; cursor: pointer; font-size: 13px;
}
.draw-tools button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.drawbox .chk { display: flex; gap: 7px; align-items: center; font-size: 12.5px; color: var(--muted); }
.drawbox .chk input { margin: 0; }
.draw-tools .btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 600; }
.draw-tools .btn-primary:hover:not(:disabled) { background: #000; color: #fff; border-color: #000; }
.draw-tools .btn-primary:disabled { opacity: .35; cursor: default; }

.sect { margin-bottom: 16px; }
.sect h3 {
  margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted);
}
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 3px 12px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.kv dd.na, .tbl td.na { color: #b5aea3; }
.tbl { border-collapse: collapse; font-size: 12.5px; width: 100%; }
.tbl th, .tbl td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-weight: 600; color: var(--muted); font-size: 11.5px; }

.chain { display: flex; flex-direction: column; gap: 8px; }
.step { padding: 8px 12px 8px 10px; border-left: 3px solid var(--line); background: var(--paper); border-radius: 0 6px 6px 0; }
.step.orig { border-left-color: #c9c1b3; }
.step.final { border-left-color: var(--accent); }
.step .lb { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.step .tx { margin: 0; font-size: 13.5px; }
.step .note { margin: 4px 0 0; font-size: 12px; color: var(--muted); font-style: italic; }
.prose { margin: 0 0 8px; font-size: 13px; }
.prose b { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }

@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar { position: static; flex-basis: auto; width: 100%; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .modal-panel { inset: 0; border-radius: 0; }
  .visuals { flex-direction: column; flex-basis: auto; }
  .viewport { flex-basis: 36vh; }
  .viewport + .viewport { border-left: 0; border-top: 1px solid #222; }
}
