/* Manrope, the body face of our own site, served from this folder (vendor/fonts/manrope, SIL OFL 1.1): no request
   leaves the page for it, and the local studio has it offline. */
@font-face { font-family: "Manrope"; font-weight: 400; font-style: normal; font-display: swap; src: url("../vendor/fonts/manrope/Manrope-Regular.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 500; font-style: normal; font-display: swap; src: url("../vendor/fonts/manrope/Manrope-Medium.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 600; font-style: normal; font-display: swap; src: url("../vendor/fonts/manrope/Manrope-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 700; font-style: normal; font-display: swap; src: url("../vendor/fonts/manrope/Manrope-Bold.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 800; font-style: normal; font-display: swap; src: url("../vendor/fonts/manrope/Manrope-ExtraBold.woff2") format("woff2"); }
:root {
  --bg: #0a0a0b; --panel: #111214; --panel-2: #17181b; --panel-3: #1e2024; --line: #26282c; --line-2: #33363c;
  --text: #e9ecef; --muted: #8b9199; --accent: #c8f31d; --accent-ink: #0c0f00; --warn: #ffb020; --danger: #ff6b6b;
  --orange: #ff9a3c; --radius: 6px;
  --font: "Manrope", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text); font: 12.5px/1.4 var(--font); overflow: hidden;
  display: grid; grid-template-rows: 44px minmax(0, 1fr) 196px; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

/* ---------- buttons and fields ---------- */
.btn {
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 5px 11px;
  cursor: pointer; white-space: nowrap; line-height: 1.25;
}
.btn:hover { background: var(--panel-3); border-color: #4a4e56; }
.btn:focus-visible, .tool:focus-visible, .chip:focus-visible, .o-item:focus-visible, .swatch:focus-visible, .seg button:focus-visible, .link:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: #d8ff3a; }
.btn.ghost { background: transparent; }
.btn.ghost.on, .btn.on { border-color: var(--accent); color: var(--accent); }
.btn.danger { color: var(--danger); background: transparent; }
.btn.danger:hover { border-color: var(--danger); }
.link { background: none; border: 0; padding: 0; color: var(--warn); cursor: pointer; text-align: left; }
.link:hover { text-decoration: underline; }
.sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 4px; flex: none; }

.f-num, .f-text, .f-select {
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 5px; padding: 4px 6px; min-width: 0; width: 100%;
}
.f-num { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12px; }
.f-num:focus, .f-text:focus, .f-select:focus { outline: none; border-color: var(--accent); }
textarea.f-text { resize: vertical; min-height: 54px; line-height: 1.35; }
.f-select { padding-right: 2px; }
.f-range { width: 100%; accent-color: var(--accent); min-width: 60px; }
.f-color { width: 26px; height: 22px; padding: 0; border: 1px solid var(--line-2); border-radius: 5px; background: none; cursor: pointer; flex: none; }
.f-row { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 8px; align-items: center; margin: 5px 0; }
.f-label { color: var(--muted); }
.f-ctl { display: flex; gap: 5px; align-items: center; min-width: 0; flex-wrap: wrap; }
.f-ctl > .f-num { flex: 1 1 58px; }
.f-ctl > .f-select { flex: 1 1 84px; }
.f-ctl > .f-range { flex: 1 1 36%; }
.f-ctl > .f-range + .f-num { flex: 0 0 56px; }
.f-axis { display: flex; align-items: center; gap: 3px; flex: 1 1 0; min-width: 0; }
.f-row:has(.f-axis) { grid-template-columns: minmax(0, 1fr); gap: 3px; } /* two or three numbers side by side need the whole width: their label goes above */
.f-axis .f-num { padding: 4px 5px; appearance: textfield; -moz-appearance: textfield; } /* no spin buttons here: they hid the digits. The arrow keys still step */
.f-axis .f-num::-webkit-inner-spin-button, .f-axis .f-num::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.f-axis em { font-style: normal; color: var(--muted); font-size: 12px; width: 10px; text-align: center; flex: none; }
.f-check { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; cursor: pointer; }
.f-check input { accent-color: var(--accent); }
.unit { color: var(--muted); white-space: nowrap; flex: none; }
.note { color: var(--muted); font-size: 12px; margin: 6px 0 2px; text-wrap: pretty; }
.chips, .btn-row { display: flex; gap: 5px; flex-wrap: wrap; margin: 5px 0; }
.chip {
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 20px; padding: 4px 10px; cursor: pointer;
  font-size: 12px; font-variant-numeric: tabular-nums;
}
button.chip:hover { border-color: #4a4e56; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.swatches { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.swatch { width: 20px; height: 20px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; box-shadow: inset 0 0 0 1px #0006; }
.swatch.on { border-color: #fff; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.grid3 .btn { padding: 5px 6px; white-space: normal; line-height: 1.2; } /* a long pose name takes two lines, not an ellipsis */
.poses .btn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* ---------- top bar ---------- */
.top { display: flex; align-items: center; gap: 12px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--panel); min-width: 0; }
.brand { font-weight: 700; font-size: 14px; letter-spacing: 0.01em; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.mark { width: 12px; height: 12px; background: var(--accent); border-radius: 2px; transform: rotate(45deg); }
.shot-name { background: transparent; border: 1px solid transparent; border-radius: 5px; padding: 4px 8px; width: min(280px, 24vw); color: var(--text); }
.shot-name:hover { border-color: var(--line-2); }
.shot-name:focus { outline: none; border-color: var(--accent); background: var(--bg); }
.save-state { color: var(--muted); font-size: 12px; white-space: nowrap; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
#btn-phone.on, #btn-ai.on { border-color: var(--accent); color: var(--accent); background: #1c2400; }
.ai-log { max-height: 180px; overflow: auto; margin: 6px 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: 6px; }
.ai-log li { padding: 4px 8px; border-bottom: 1px solid #191a1d; font-size: 12px; display: flex; gap: 8px; }
.ai-log li time { color: var(--muted); font-family: var(--mono); flex: none; }
.dlg pre { background: var(--bg); border: 1px solid var(--line-2); border-radius: 6px; padding: 8px 10px; font: 12px var(--mono); white-space: pre-wrap; word-break: break-all; user-select: all; margin: 6px 0; }
.live-chip { position: absolute; left: 50%; top: 46px; transform: translateX(-50%); background: #2a0d0e; color: #ff8a8a; border: 1px solid #e5484d; border-radius: 20px; padding: 4px 11px; font-size: 12px; pointer-events: none; white-space: nowrap; }
.qr { width: 190px; height: 190px; background: #fff; border-radius: 8px; padding: 6px; flex: none; }
.qr svg { width: 100%; height: 100%; display: block; }
.pair { display: flex; gap: 16px; align-items: flex-start; }
.pair ol { margin: 0; padding-left: 18px; }
.pair li { margin: 0 0 6px; }
.take-row { display: flex; align-items: center; gap: 6px; margin: 4px 0; }
.take-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nod3 { font-weight: 800; letter-spacing: 0.14em; font-size: 13px; color: var(--text); padding-left: 6px; }
a.nod3 { text-decoration: none; border-radius: 4px; } /* the public edition: the mark goes back to the site */
a.nod3:hover, a.nod3:focus-visible { color: var(--accent); }
/* The phone link and the AI link need the local server: they stay out of the way without it (the public edition). */
.no-server #btn-ai, .no-server #btn-phone, .no-server #sep-link { display: none; }

/* ---------- work area ---------- */
.work { display: grid; grid-template-columns: 208px minmax(0, 1fr) 308px; min-height: 0; }
.left, .right { background: var(--panel); overflow-y: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.left { border-right: 1px solid var(--line); padding: 4px 8px 12px; }
.right { border-left: 1px solid var(--line); padding: 10px 12px 20px; }
.right h2 { font-size: 14px; font-weight: 600; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }
.dot.sq { border-radius: 2px; }
.sec { border-top: 1px solid var(--line); padding: 8px 0 6px; }
.sec:first-of-type { border-top: 0; padding-top: 0; }
.sec h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.warn-list { margin: 4px 0; padding-left: 16px; }
.warn-list li { margin: 3px 0; color: var(--warn); }
.ramp-row { display: flex; gap: 6px; align-items: center; margin: 4px 0; }

.o-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 12px 2px 4px; min-height: 24px; }
.o-head h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; color: var(--muted); font-weight: 600; }
.o-add { width: 78px; flex: none; font-size: 12px; padding: 4px 6px; }
.o-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 6px; border-radius: 5px; border: 1px solid transparent;
  background: transparent; cursor: pointer; text-align: left;
}
.o-item:hover { background: var(--panel-2); }
.o-item.on { background: var(--panel-3); border-color: var(--accent); }
.o-item i { width: 10px; height: 10px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px #0006; }
.o-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o-sub { color: var(--muted); font-size: 12px; flex: none; }

.views { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 42%); grid-template-rows: minmax(0, 1.05fr) minmax(0, 1fr); gap: 1px; background: var(--line); min-width: 0; min-height: 0; }
#view-editor { grid-area: 1 / 1 / 3 / 2; }
#view-shot { grid-area: 1 / 2 / 2 / 3; }
#view-plan { grid-area: 2 / 2 / 3 / 3; }
.views.swap #view-shot { grid-area: 1 / 1 / 3 / 2; }
.views.swap #view-editor { grid-area: 1 / 2 / 2 / 3; }
.view { position: relative; background: #050506; min-width: 0; min-height: 0; overflow: hidden; container-type: inline-size; }
.view canvas { display: block; }
#editor-canvas, #plan-canvas { width: 100%; height: 100%; touch-action: none; }
#editor-canvas { cursor: grab; }
.shot-frame { position: absolute; inset: 40px 8px 40px; display: grid; place-items: center; }
#shot-canvas { touch-action: none; cursor: move; box-shadow: 0 0 0 1px #3a3e45; }
.ref-video { position: absolute; pointer-events: none; object-fit: fill; }
.guides { position: absolute; pointer-events: none; }
.guides i { position: absolute; background: #ffffff66; }
.guides i:nth-child(1), .guides i:nth-child(2) { top: 0; bottom: 0; width: 1px; }
.guides i:nth-child(1) { left: 33.333%; } .guides i:nth-child(2) { left: 66.666%; }
.guides i:nth-child(3), .guides i:nth-child(4) { left: 0; right: 0; height: 1px; }
.guides i:nth-child(3) { top: 33.333%; } .guides i:nth-child(4) { top: 66.666%; }
.view > .chip { position: absolute; left: 8px; top: 6px; cursor: default; background: #000a; pointer-events: none; }
.view > .chip.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.tools { position: absolute; left: 72px; top: 5px; display: flex; align-items: center; gap: 3px; background: #000a; border: 1px solid var(--line-2); border-radius: 8px; padding: 3px; flex-wrap: wrap; max-width: calc(100% - 80px); }
.tool { background: transparent; border: 1px solid transparent; border-radius: 5px; padding: 4px 9px; cursor: pointer; font-size: 12px; }
.tool:hover { background: var(--panel-3); }
.tool.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.views.swap #view-editor .tools { display: none; }
.seg { position: absolute; right: 8px; top: 5px; display: flex; background: #000a; border: 1px solid var(--line-2); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { background: transparent; border: 0; border-radius: 5px; padding: 4px 9px; cursor: pointer; font-size: 12px; }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.badge { position: absolute; left: 8px; bottom: 7px; pointer-events: auto; background: #000a; border: 1px solid var(--line-2); border-radius: 5px; padding: 4px 9px; font: 12px var(--mono); pointer-events: none; white-space: nowrap; max-width: calc(100% - 250px); overflow: hidden; text-overflow: ellipsis; }
.view-actions { position: absolute; right: 8px; bottom: 6px; display: flex; gap: 5px; }
.view-actions .btn { background: #000c; }
.view-actions .btn:hover { background: var(--panel-3); }
.hint { position: absolute; left: 8px; bottom: 8px; color: #aeb3ba; font-size: 12px; pointer-events: none; text-shadow: 0 1px 2px #000; max-width: calc(100% - 250px); }
#view-plan .hint { max-width: calc(100% - 16px); color: #6f757d; }
.views.swap #view-editor .hint, .views.swap #view-editor .view-actions { display: none; }
.warn-chip { position: absolute; left: 110px; top: 6px; background: #2a1d00; color: var(--warn); border: 1px solid #6b4a00; border-radius: 20px; padding: 4px 10px; font-size: 12px; cursor: pointer; max-width: calc(100% - 300px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- timeline ---------- */
.tl { border-top: 1px solid var(--line); background: var(--panel); display: grid; grid-template-rows: 34px minmax(0, 1fr); min-height: 0; }
.tl-bar { display: flex; align-items: center; gap: 12px; padding: 0 10px; border-bottom: 1px solid var(--line); }
.transport, .tl-right { display: flex; gap: 4px; align-items: center; }
.tl-right { margin-left: auto; }
#tr-play { min-width: 58px; }
.readout { font: 12px var(--mono); color: var(--muted); white-space: nowrap; }
.readout b { color: var(--text); font-weight: 500; }
.tl-body { display: grid; grid-template-columns: 208px minmax(0, 1fr); min-height: 0; }
.tl-labels-col { border-right: 1px solid var(--line); display: grid; grid-template-rows: 22px minmax(0, 1fr); min-height: 0; }
.tl-corner { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; padding: 4px 10px; border-bottom: 1px solid var(--line); }
.tl-labels { overflow: hidden; }
.tl-label { height: 24px; display: flex; align-items: center; gap: 8px; padding: 0 10px; cursor: pointer; border-bottom: 1px solid #191a1d; }
.tl-label.on { background: var(--panel-3); color: var(--accent); }
.tl-label i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.tl-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-lanes { margin-right: var(--corner-w, 0px); position: relative; display: grid; grid-template-rows: 22px minmax(0, 1fr); min-height: 0; min-width: 0; cursor: ew-resize; touch-action: none; user-select: none; }
.tl-ruler { width: 100%; height: 22px; display: block; border-bottom: 1px solid var(--line); }
.tl-rows { overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.tl-lane { position: relative; height: 24px; border-bottom: 1px solid #191a1d; }
.tl-lane.on { background: #ffffff08; }
.tl-span { position: absolute; top: 11px; height: 2px; opacity: 0.45; border-radius: 1px; pointer-events: none; }
.tl-key {
  position: absolute; top: 6px; width: 11px; height: 11px; margin-left: -5.5px; transform: rotate(45deg); background: var(--c);
  border: 1px solid #000a; cursor: grab; border-radius: 1.5px;
}
.tl-key:hover { filter: brightness(1.25); }
.tl-key.on { background: #fff; box-shadow: 0 0 0 2px var(--accent); z-index: 2; }
.tl-key.beat { border-radius: 50%; transform: none; background: #cfd3d8; width: 9px; height: 9px; margin-left: -4.5px; top: 7px; }
.tl-key.beat.on { background: #fff; }
.tl-key.cut::before { content: ""; position: absolute; left: -7px; top: -7px; width: 1px; height: 30px; background: #fff; transform: rotate(-45deg); transform-origin: 6px 12px; opacity: 0.8; }
.tl-key.gait::after { content: ""; position: absolute; left: 12px; top: 12px; width: 5px; height: 5px; border-radius: 50%; background: var(--c); transform: rotate(-45deg); opacity: 0.9; }
.tl-playhead { position: absolute; top: 0; bottom: 0; width: 1px; background: #ff4d5e; pointer-events: none; z-index: 3; }
.tl-playhead::before { content: ""; position: absolute; top: 0; left: -5px; border: 5px solid transparent; border-top: 7px solid #ff4d5e; }

/* ---------- floating bits ---------- */
.tip { position: fixed; z-index: 30; background: #0d0e10; border: 1px solid #4d6dff; color: #fff; padding: 5px 10px; border-radius: 6px; font-size: 12px; pointer-events: none; white-space: nowrap; }
.toast { position: fixed; left: 50%; bottom: 212px; transform: translateX(-50%); z-index: 40; background: #17181b; border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 14px; box-shadow: 0 8px 30px #000a; max-width: min(720px, 90vw); }
.toast a { color: var(--accent); }
.toast code { font: 12px var(--mono); color: #cfd3d8; user-select: all; word-break: break-all; }
.dlg { background: var(--panel); color: var(--text); border: 1px solid var(--line-2); border-radius: 10px; padding: 0; width: min(560px, 92vw); box-shadow: 0 20px 80px #000c; }
.dlg::backdrop { background: #000a; }
.dlg form, .dlg .dlg-body { padding: 16px 18px; }
.dlg h2 { font-size: 15px; margin-bottom: 10px; }
.dlg .dlg-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.dlg .list { display: grid; gap: 4px; max-height: 300px; overflow: auto; margin: 8px 0; }
.dlg .list .o-item { border-color: var(--line); }
.dlg .cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.dlg .card { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px; cursor: pointer; text-align: left; }
.dlg .card:hover { border-color: var(--accent); }
.dlg .card b { display: block; margin-bottom: 2px; }
.dlg .card span { color: var(--muted); font-size: 12px; }
.dlg kbd { font: 12px var(--mono); background: var(--panel-3); border: 1px solid var(--line-2); border-radius: 4px; padding: 2px 6px; }
.dlg table { border-collapse: collapse; width: 100%; }
.dlg td { padding: 3px 8px 3px 0; vertical-align: top; }
.dlg td:first-child { white-space: nowrap; color: var(--muted); width: 1%; }
.progress { height: 6px; background: var(--panel-3); border-radius: 3px; overflow: hidden; margin: 10px 0 6px; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); }
.dlg video { width: 100%; border-radius: 6px; background: #000; margin-top: 8px; max-height: 46vh; }

/* narrow views: tighter toolbar, fewer overlay extras */
@container (max-width: 520px) {
  .tools { left: 66px; max-width: calc(100% - 74px); }
  .tools .tool { padding: 3px 6px; }
  .tools .sep { display: none; }
  #view-editor .hint { display: none; }
}
@container (max-width: 420px) {
  #btn-guides { display: none; }
  #view-plan .hint { display: none; }
  .warn-chip { top: auto; bottom: 44px; left: 8px; max-width: calc(100% - 16px); } /* no room beside the pass buttons: it sits over the foot of the picture */
  .badge { max-width: calc(100% - 140px); }
}
@media (max-width: 1440px) {
  /* eleven buttons in the top bar: give the shot name less room and close the gaps before anything is cut off */
  .top { gap: 8px; }
  .shot-name { width: min(200px, 13vw); }
  .top-actions { gap: 4px; }
  .top-actions .sep { margin: 0 1px; }
  .work { grid-template-columns: 188px minmax(0, 1fr) 284px; }
  .tl-body { grid-template-columns: 188px minmax(0, 1fr); }
}
@media (max-width: 1300px) {
  .shot-name { display: none; } /* the name is still in the inspector, under Shot settings */
}
@media (max-width: 1180px) {
  .save-state, .nod3, .brand-name { display: none; } /* the lime mark stays; the buttons keep their full padding */
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
