/* 미리 보기 재생 (docs/ui-api.md 23절, js/ui/playback.js) — 3D 보기 아래 재생 막대 · 타임라인 · 사이클 시간 나누어 보기
   색: 자유 이동 = 계획 경로 파랑(--path-free), 직선 = 청록(--path-lin), 그리퍼 = 강조(--accent), 시간 대기 = 회색 빗금,
   신호·명령 대기·출력 = 폭 없는 표시(--warn). 예전 계획(scene_ok=false) 은 막대 테두리·칩이 경고색. */
:root {
  --pb-free: var(--path-free); --pb-lin: var(--path-lin); --pb-grip: var(--accent); --pb-marker: var(--warn);
  --pb-wait: #a6a6a6; --pb-wait-2: #d4d4d4; --pb-rank: #111111; --pb-panel: rgb(255 255 255 / .94);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --pb-wait: #5c5c5c; --pb-wait-2: #383838; --pb-rank: #f5f5f5; --pb-panel: rgb(18 18 18 / .94); }
}
:root[data-theme="dark"] { --pb-wait: #5c5c5c; --pb-wait-2: #383838; --pb-rank: #f5f5f5; --pb-panel: rgb(18 18 18 / .94); }

/* ---------------------------------------------------------------- 재생 막대 (3D 보기 아래쪽) */
.pbbar {
  position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 4;
  display: grid; gap: 6px; padding: 8px 10px;
  background: var(--pb-panel); border: 1px solid var(--line); border-top: 4px solid var(--accent);
  border-radius: var(--r-m); box-shadow: 0 6px 18px rgb(0 0 0 / .18);
  min-width: 0;
}
.pbbar[hidden] { display: none; }
.pbbar[data-stale] { border-top-color: var(--warn); }
/* 막대가 열리면 3D 보기 아래쪽에 붙은 것(좌표 표시·칩·훈련 탐침 램프 #probeMini)을 막대 위로 (가리지 않게 — 훈련 중에도 재생 가능) */
.view[data-pb] .view__readout { bottom: calc(var(--pb-h, 150px) + 18px); }
.view[data-pb] .mchip { bottom: calc(var(--pb-h, 150px) + 60px); }
.view[data-pb] .probe--mini { bottom: calc(var(--pb-h, 150px) + 18px); }

.pbchip { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13.5px; font-weight: 650; }
.pbchip > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbchip__lamp { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.pbchip[data-s="ok"] .pbchip__lamp { background: var(--ok); }
.pbchip[data-s="wait"] .pbchip__lamp { background: var(--warn); }
.pbchip[data-s="bad"] { color: var(--warn-text); }
.pbchip[data-s="bad"] .pbchip__lamp { background: var(--warn); }

.pbbar__row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.pbbtn {
  min-height: var(--tap); min-width: var(--tap); padding: 0 12px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 650; cursor: pointer; touch-action: manipulation;
}
.pbbtn:hover:not(:disabled) { border-color: var(--ink-3); }
.pbbtn:disabled { opacity: .45; cursor: not-allowed; }
.pbbtn--play { min-width: 112px; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pbbtn--play[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.pbbtn--close { margin-left: auto; }
.pbbar__time { font-variant-numeric: tabular-nums; font-weight: 700; padding: 0 6px; white-space: nowrap; }
.pbbar__speed button { min-width: 0; padding: 0 9px; }
.pbbar__speedsel { display: none; min-height: var(--tap); border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; }
.pbbar__branch { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.pbbar__branch[hidden] { display: none; }
.pbbar__br { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; }
.pbbar__br select { min-height: var(--tap); border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; }
.pbbar__note { margin: 0; font-size: 12.5px; color: var(--ink-2); }
.pbbar__note[data-err] { color: var(--warn-text); font-weight: 650; }

/* ---------------------------------------------------------------- 타임라인 */
.pbtrack { position: relative; height: max(48px, var(--tap)); min-width: 0; }      /* 끌기 칸 = 터치 최소 높이 (구간 막대는 아래 26px) */
.pbtrack__segs { position: absolute; left: 0; right: 0; top: 14px; bottom: 8px; }
.pbseg {
  position: absolute; top: 0; bottom: 0; min-width: 1px;
  background: var(--pb-free); border-right: 1px solid var(--pb-panel); box-sizing: border-box;
}
.pbseg[data-k="lin"] { background: var(--pb-lin); }
.pbseg[data-k="blend"] { background: linear-gradient(90deg, var(--pb-free), var(--pb-lin)); }
.pbseg[data-k="gripper"] { background: var(--pb-grip); }
.pbseg[data-k="wait_time"] { background: repeating-linear-gradient(135deg, var(--pb-wait) 0 4px, var(--pb-wait-2) 4px 8px); }
.pbseg[data-k="unknown"] { background: var(--ink-3); }
.pbseg[data-marker] { width: 2px; margin-left: -1px; background: var(--pb-marker); border: 0; }
.pbseg[data-marker]::before {             /* ◆ 표시 */
  content: ""; position: absolute; left: -4px; top: -6px; width: 8px; height: 8px;
  background: var(--pb-marker); transform: rotate(45deg);
}
.pbseg[data-rank] { outline: 2px solid var(--pb-rank); outline-offset: -2px; z-index: 1; }
.pbseg__lbl { position: absolute; left: 3px; top: 50%; transform: translateY(-50%); font-size: 11px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.pbseg__join { position: absolute; top: -2px; bottom: -2px; width: 0; border-left: 2px dotted var(--pb-panel); }
.pbbr {                                   /* 반복 '×3' · 조건 반복 괄호 (막대 위) */
  position: absolute; top: 0; height: 12px; box-sizing: border-box;
  border: 2px solid var(--ink-3); border-bottom: 0; border-radius: 3px 3px 0 0;
  font-size: 10.5px; line-height: 10px; font-weight: 700; color: var(--ink-2); text-align: center;
  overflow: hidden; white-space: nowrap;
}
.pbbr[data-k="loop"] { border-style: dashed; }
.pbbr__iter { position: absolute; top: 12px; bottom: -2px; width: 0; border-left: 1px dashed var(--ink-2); }
.pbtrack__head {
  position: absolute; top: 10px; bottom: -3px; width: 3px; margin-left: -1.5px; left: 0;
  background: var(--ink); border-radius: 2px; pointer-events: none; z-index: 2;
}
.pbtrack__scrub {                          /* 타임라인 위에 겹친 투명 끌기 (키보드: ← → Home End) */
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 3;
}
.pbtrack:has(.pbtrack__scrub:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------------------------------------------------------------- 프로그램 탭 줄 목록: 미리 보기 지금 줄 (실행 강조 data-cur 와 다른 점선) */
.pl[data-pv] > .pl__row { outline: 2px dashed var(--accent); outline-offset: -2px; }
.pl[data-pv][data-cur] > .pl__row { outline: 0; }

/* ---------------------------------------------------------------- 계획·실행 탭 카드: 미리 보기 단추 · 사이클 시간 나누어 보기 */
/* 열기 단추가 '닫기' 로 바뀐 상태 (#pbOpenBtn · #pgmPreview — 누르면 닫힘) */
.btn[data-pbopen] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.pbcard { margin-top: 10px; display: grid; gap: 6px; }
.pbcard[hidden] { display: none; }
.pbcard__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pbcard__row .help { margin: 0; }
.pbsort { margin: 6px 0; }
.pbbreak tbody tr { cursor: pointer; }
.pbbreak .linkbtn { min-height: var(--tap); min-width: var(--tap); padding: 0 6px; }   /* '블록 ↗' — 행(누르면 이동) 안의 따로 누르는 칸이므로 터치 크기 */
.pbbreak tbody tr:hover, .pbbreak tbody tr:focus-visible { background: var(--accent-soft); }
.pbbreak td:nth-child(3), .pbbreak td:nth-child(4) { font-variant-numeric: tabular-nums; text-align: right; }
.pbbreak td:last-child { width: 30%; min-width: 60px; }
.pbbar__bar { display: block; height: 10px; border-radius: 2px; background: var(--pb-free); min-width: 2px; }
.pbbar__bar[data-k="lin"] { background: var(--pb-lin); }
.pbbar__bar[data-k="gripper"] { background: var(--pb-grip); }
.pbbar__bar[data-k="wait_time"] { background: var(--pb-wait); }
.pbbreak tr[data-rank] td:first-child { font-weight: 700; }
.pbrank {
  display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--pb-rank); color: var(--surface); font-size: 12px;
}

/* 좁은 화면 (태블릿 세로·휴대폰): 속도 seg → select, 단추 글자 줄임 없이 줄바꿈 */
@media (max-width: 600px) {
  .pbbar { left: 6px; right: 6px; bottom: 6px; padding: 6px; }
  .pbbar__speed { display: none; }
  .pbbar__speedsel { display: inline-block; }
  .pbbtn--play { min-width: 0; }
  .pbbreak td:last-child { display: none; }
}

/* ---------------------------------------------------------------- 가는 점 (23절 '가는 점', js/ui/gotarget.js · gotarget3d.js)
   강조색 --go = 자홍 (경로 파랑·청록 · 경고 주황 · 오류 빨강 · 두 번째 화면 남보라와 겹치지 않게) — 3D 고리·핀·이름표와 같은 색 */
:root { --go: #c2187a; --go-soft: #f7dcec; --go-ink: #ffffff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --go: #ff5cb8; --go-soft: #3d1630; --go-ink: #22041a; }
}
:root[data-theme="dark"] { --go: #ff5cb8; --go-soft: #3d1630; --go-ink: #22041a; }
/* 3D 보기 위쪽 가운데 — 실행 중 지금 가는 점 (아래쪽 칩·좌표 표시와 겹치지 않게) */
.gochip {
  position: absolute; top: 58px; left: 50%; transform: translateX(-50%); z-index: 3;
  max-width: calc(100% - 32px); display: flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px;
  background: var(--go); color: var(--go-ink);
  font-size: 14px; font-weight: 700; box-shadow: 0 4px 14px rgb(0 0 0 / .22);
  pointer-events: none;
}
.gochip[hidden] { display: none; }
.gochip > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gochip__pin { flex: none; font-size: 12px; }
/* 실행 카드·진행 탭 '지금: 집기 → start_point_003 (배열 1 · 칸 3/25)' */
.gorun {
  margin: 6px 0 0; padding: 4px 10px; border-left: 4px solid var(--go); border-radius: var(--r-s);
  background: var(--go-soft); color: var(--ink); font-weight: 650; font-size: 13.5px; overflow-wrap: anywhere;
}
.gorun[hidden] { display: none; }
@media (max-width: 600px) { .gochip { top: 52px; font-size: 13px; padding: 5px 12px; } }
