/* vbt.html — video velocity page. Light surface like log.html; the video stage is dark. */
.vbt-btn-primary {
  display: inline-flex; align-items: center; gap: .5rem; background: #7c3aed; color: #fff; font-weight: 600;
  font-size: .875rem; padding: .625rem 1.1rem; border-radius: .5rem; min-height: 44px; transition: background .15s;
}
.vbt-btn-primary:hover { background: #6d28d9; }
.vbt-btn-primary:disabled { background: #c4b5fd; cursor: not-allowed; }
.vbt-btn-ghost {
  display: inline-flex; align-items: center; gap: .4rem; background: #fff; color: #334155; font-size: .875rem;
  padding: .55rem 1rem; border: 1px solid #cbd5e1; border-radius: .5rem; min-height: 44px;
}
.vbt-btn-ghost:hover { background: #f8fafc; }
.vbt-btn-ghost[aria-pressed="true"] { background: #ede9fe; border-color: #a78bfa; color: #5b21b6; }

.vbt-field { display: flex; flex-direction: column; gap: .25rem; font-size: .875rem; color: #334155; }
.vbt-field > span:first-child { font-weight: 500; }
.vbt-field input[type="number"], .vbt-field input[type="text"], .vbt-field select {
  border: 1px solid #cbd5e1; border-radius: .5rem; padding: .55rem .7rem; font-size: 1rem; background: #fff; min-height: 44px;
}
.vbt-field input[type="range"] { width: 100%; accent-color: #7c3aed; min-height: 32px; }
.vbt-check { display: flex; align-items: center; gap: .5rem; font-size: .875rem; color: #334155; min-height: 44px; }
.vbt-check input { width: 1.1rem; height: 1.1rem; accent-color: #7c3aed; flex: none; }
.vbt-chip { font-size: .75rem; border: 1px solid #c4b5fd; color: #5b21b6; background: #f5f3ff; border-radius: 999px; padding: .2rem .6rem; min-height: 28px; }

.vbt-stage { position: relative; background: #0c1016; border-radius: .75rem; overflow: hidden; max-height: 70vh; display: flex; justify-content: center; }
.vbt-canvas { display: block; max-width: 100%; max-height: 70vh; width: auto; height: auto; touch-action: manipulation; cursor: crosshair; }
.vbt-stage video { display: block; max-width: 100%; max-height: 70vh; width: auto; height: auto; }
.vbt-overlay { position: absolute; pointer-events: none; }

.vbt-progress { height: .6rem; background: #ede9fe; border-radius: 999px; overflow: hidden; }
.vbt-progress > div { height: 100%; width: 0; background: #7c3aed; transition: width .2s; }

.vbt-stat { background: #f8fafc; border-radius: .6rem; padding: .6rem .3rem; }
.vbt-stat b { display: block; font-size: 1.35rem; color: #0f172a; font-variant-numeric: tabular-nums; }
.vbt-stat span { font-size: .72rem; color: #64748b; }

.vbt-card { background: #fff; border-radius: .75rem; box-shadow: 0 1px 2px rgba(15, 23, 42, .06); padding: 1rem; border-left: 4px solid #94a3b8; }
.vbt-card[data-kind="LÀM"] { border-left-color: #7c3aed; }
.vbt-card[data-kind="ĐỀ XUẤT"] { border-left-color: #d97706; }
.vbt-card[data-kind="GIỮ"] { border-left-color: #059669; }
.vbt-card[data-kind="MỐC"] { border-left-color: #2563eb; }
.vbt-card[data-kind="QUAY LẠI"] { border-left-color: #dc2626; }
.vbt-card .kind { font-size: .7rem; font-weight: 700; letter-spacing: .04em; color: #64748b; }
.vbt-card h4 { font-weight: 600; color: #0f172a; margin: .15rem 0 .35rem; }
.vbt-card p { font-size: .875rem; color: #334155; margin-top: .3rem; }
.vbt-card .ev { font-size: .78rem; color: #64748b; font-variant-numeric: tabular-nums; }

.vbt-table th { text-align: right; font-weight: 600; color: #475569; padding: .35rem .4rem; border-bottom: 1px solid #e2e8f0; white-space: nowrap; font-size: .75rem; }
.vbt-table td { text-align: right; padding: .4rem; border-bottom: 1px solid #f1f5f9; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vbt-table th:first-child, .vbt-table td:first-child { text-align: left; }
.vbt-table tr.best td { background: #f5f3ff; }
.vbt-table .flag { color: #b45309; font-size: .72rem; }
.vbt-chart { position: relative; height: 200px; }

.vbt-qc { display: flex; gap: .55rem; align-items: flex-start; }
.vbt-qc i { margin-top: .2rem; }
.vbt-qc[data-level="ok"] i { color: #059669; }
.vbt-qc[data-level="warn"] i { color: #d97706; }
.vbt-qc[data-level="fail"] i { color: #dc2626; }
.vbt-qc small { display: block; color: #64748b; }

/* Do not depend on the Tailwind CDN for show/hide: steps must hide even if it fails to load. */
.hidden { display: none !important; }
/* The rep table is wider than a phone: it scrolls inside its card, never the page. */
.vbt-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
#step-result, #step-result > * { min-width: 0; }

/* Rep rows open to show the secondary numbers */
.vbt-table tr.rep-row { cursor: pointer; }
.rep-toggle { display: inline-flex; align-items: center; gap: .4rem; min-height: 36px; font-weight: 600; color: #0f172a; }
.rep-toggle i { font-size: .65rem; color: #94a3b8; transition: transform .15s; }
.rep-toggle[aria-expanded="true"] i { transform: rotate(90deg); }
.vbt-table tr.rep-more td { text-align: left; background: #f8fafc; white-space: normal; padding: .5rem .6rem .7rem; }
.rep-more dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: .35rem .9rem; }
.rep-more dl > div { display: flex; justify-content: space-between; gap: .5rem; font-size: .8rem; }
.rep-more dt { color: #64748b; }
.rep-more dd { color: #0f172a; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .rep-toggle i, .vbt-progress > div { transition: none; } }

/* Handles on the two scale lines. Only the handle swallows touch gestures, so the page still scrolls
   when a finger lands anywhere else on the picture. */
.vbt-handle {
  position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; touch-action: none;
  background: rgba(250, 204, 21, .92); color: #422006; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .5);
  display: flex; align-items: center; justify-content: center; font-size: .9rem; cursor: ns-resize;
}
.vbt-handle:focus-visible { outline: 3px solid #7c3aed; outline-offset: 2px; }
/* Side handles (how wide the plate looks) and the centre handle: same size, different colour, so the two
   yellow ones — the only ones that set the scale — stand apart. */
.vbt-handle.side { background: rgba(34, 197, 94, .92); color: #052e16; cursor: ew-resize; }
.vbt-handle.centre { background: rgba(255, 255, 255, .92); color: #0f172a; cursor: move; width: 36px; height: 36px; margin: -18px 0 0 -18px; }
.vbt-chart.short { height: 150px; }
#path-canvas { display: block; max-width: 100%; }
