/* Camcorder workbench: neutral surfaces and one accent for active controls. */
:root {
  --ground:#101316; --panel:#171b1f; --panel-2:#21272c; --line:#30383e; --line-2:#46515a;
  --text:#e0e5e8; --muted:#a0abb3; --dim:#69747c;
  --amber:#accbde; --amber-dim:#7894a5; --cyan:#b4cedc; --rec:#d37c6c;
  --ui-font:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;
}
html, body { margin: 0; height: 100%; background: var(--ground); color: var(--text); font: 12.5px/1.45 var(--ui-font); }
* { box-sizing: border-box; }
/* A drag on a dial, a header or the picture never selects text; only the boxes you type in do. */
.bar, .stage, .rail { user-select: none; -webkit-user-select: none; }
.rail input, .rail select, .rail textarea { user-select: text; -webkit-user-select: text; }
button { font: inherit; color: inherit; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 3px; padding: 5px 10px; cursor: pointer; }
button:hover { border-color: var(--amber-dim); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }
button.on { border-color: var(--amber); color: var(--amber); background: #283944; }

.app { display: grid; grid-template-rows: auto 1fr; grid-template-columns: 1fr 336px; height: 100vh; }
.bar { grid-column: 1 / -1; display: flex; flex-wrap:wrap; align-items: center; min-height:46px; gap: 10px; padding: 7px 14px; border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.brand .title { font:600 18px/1.2 var(--ui-font); color: var(--text); letter-spacing: 0.01em; }
.brand .sub { color: var(--muted); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
/* Filming and Compare are rail rows in the Picture view; the public demo shows no Compare. */
.pick .row button[hidden] { display: none; }
body[data-demo="public"] #compareRow { display: none; }
.video-download { color:var(--amber); white-space:nowrap; }
/* The tape spine: the space you are in, at the far end of the bar, with a lamp that lights
   while a take records. It fills the bar the way a label fills the spine of a cassette. */
.spine { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted);
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; white-space: nowrap; }
.spine .rec { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2);
  transition: background-color .5s ease, box-shadow .5s ease; }
.spine.on .rec { background: #e0483c; box-shadow: 0 0 8px #e0483c; animation: spineBreath 1.6s ease-in-out infinite; }
@keyframes spineBreath { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .spine.on .rec { animation: none; } }
.video-download[hidden] { display:none; }
#play.paused { color: var(--amber); }

.stage { position: relative; background: #040302; overflow: hidden; }
.stage [hidden] { display: none; }
#tape { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* The reference clip beside the picture: the stage splits in two, the clip left, the bench right. */
.stage.compare #tape { left: 50%; width: 50%; }
.stage .ref { position: absolute; left: 0; top: 0; width: 50%; height: 100%; background: #000; border-right: 1px solid var(--line); }
.stage .ref video, .stage .ref iframe { position:absolute; top:44px; left:0; width:100%; height:calc(100% - 124px); object-fit:contain; border:0; display:block; }
.stage .ref iframe { top:44px; bottom:0; margin:auto; height:auto; aspect-ratio:16/9; max-height:calc(100% - 44px); }
.stage .ref [hidden] { display:none; }
.refsource { position:absolute; top:0; left:0; right:0; z-index:2; display:flex; align-items:center; gap:8px; padding:8px; background:var(--panel); }
.refsource select { min-width:0; flex:1; font:inherit; color:var(--text); background:var(--panel-2); border:1px solid var(--line-2); padding:5px; }
.refsource a { color:var(--amber); font-size:11px; white-space:nowrap; }
.refstatus { position:absolute; left:8px; right:8px; bottom:75px; margin:0; color:var(--text); background:var(--panel); }
.refstatus:empty { display:none; }
#roomLoading { position:absolute; top:24px; left:24px; max-width:calc(100% - 48px); padding:12px; background:#17150fe8; color:#eee5ce; }
.stage.compare #roomLoading { left:calc(50% + 16px); max-width:calc(50% - 32px); }
.stage .ref .reftag { position: absolute; left: 10px; top: 8px; color: var(--amber); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; pointer-events: none; }
.stage .ref .reftag.bench { left: auto; right: -50%; margin-right: 10px; transform: translateX(0); }
.stage .ref[hidden] { display: none; }
/* The strip is two rows: the scrubber full width on top, always in reach however narrow the
   pane, then the buttons and the clock, which wrap when they must. */
.stage .ref .reftools { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px 8px; background: linear-gradient(to top, rgba(4, 3, 2, 0.9), rgba(4, 3, 2, 0)); }
.stage .ref .reftools[hidden] { display:none; }
.stage .ref .reftools button { padding: 3px 8px; font-size: 11px; background: rgba(19, 17, 13, 0.85); }
.stage .ref .reftime { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; margin-left: 4px; white-space: nowrap; }
.stage .ref .reftools input[type=range] { flex: 1 1 100%; order: -1; min-width: 0; height: 22px; margin: 0 0 2px; accent-color: var(--amber); cursor: pointer; }
/* The site's overlay layers, placed over the picture by tape-layers.js. */
.stage .layer { position: absolute; pointer-events: none; }
.stage video.layer { object-fit: cover; mix-blend-mode: screen; opacity: 0; }
.stage .grainbox { overflow: hidden; opacity: 0; }
.stage .graintile { position: absolute; inset: -25%; mix-blend-mode: screen; animation: grain 0.6s steps(3) infinite; }
@keyframes grain { 0% { transform: translate(0, 0); } 33% { transform: translate(-3%, 2%); } 66% { transform: translate(2%, -2%); } 100% { transform: translate(0, 0); } }
.stage .scan { opacity: 0; background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,0.22) 2px 3px); }
.stage .vig { opacity: 0; box-shadow: inset 0 0 250px 60px rgba(0,0,0,0.8), inset 0 0 75px 0 rgba(0,0,0,0.5); }
.drop { position: absolute; inset: 14px; display: grid; place-items: center; border: 1px dashed var(--amber); border-radius: 6px; background: rgba(11,10,8,0.55); color: var(--amber); font: 600 28px/1 var(--ui-font); pointer-events: none; }
.group[hidden], .stage[hidden] { display: none; }
/* The tape's words: a row with its slider. */
.group.feel > summary { color: var(--amber); }
.word { margin: 6px 0; display: grid; grid-template-columns: 1fr auto auto; gap: 2px 8px; align-items: center; }
.word .wname { color: var(--text); }
.word .wval { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.word input[type=range] { grid-column: 1 / -1; width: 100%; margin: 0; height: 18px; accent-color: var(--amber); cursor: pointer; }
/* Simple: the fine dials step aside. */
.dial.notsimple { display: none; }
.stage > summary > .shake { order: 7; flex: 1 1 100%; }
.stage > summary > .shake .take { padding: 4px 8px; font-size: 11.5px; }
.stage > summary > .shake .take.live { border-color: var(--rec); color: var(--rec); }
.stage > summary > .shake .row.inline { margin-top: 6px; display: flex; gap: 6px; }
.stage > summary > .shake .row.inline input { flex: 1; min-width: 0; font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--amber); border-radius: 3px; padding: 5px 8px; }
.stage > summary > .shake .row.inline[hidden] { display: none; }
/* The shelf of shakes under the Recorded shake dials. */
.shelf { margin: 4px 0 8px; }
.shelfrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0; color: var(--text); font-size: 11.5px; }
.shelfrow button.x { padding: 0 7px; font-size: 13px; line-height: 16px; color: var(--muted); }
.shelfrow button.x:hover { color: var(--rec); border-color: var(--rec); }
/* The x on a removable choice: dim until the hand is near, then the warning colour. */
.seg button .x { margin-left: 6px; color: var(--dim); font-size: 12px; }
.seg button .x:hover { color: var(--rec); }
/* The rail tree: folding groups, and in the Stack, folding stage nodes with their switch in the header. */
.group > summary { list-style: none; cursor: pointer; margin: 14px 0 8px; font-size: 10.5px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.group > summary::before, .stage > summary::before { content: ""; width: 0; height: 0; border-left: 5px solid var(--dim); border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform 0.25s cubic-bezier(.16,.84,.3,1); }
.group[open] > summary::before, .stage[open] > summary::before { transform: rotate(90deg); }
.group > summary::-webkit-details-marker, .stage > summary::-webkit-details-marker { display: none; }
.stage { margin: 8px 0; border: 1px solid var(--line); border-radius: 6px; padding: 0 10px 2px; background: var(--panel-2); }
.stage.on { border-color: var(--amber-dim); }
/* The header is two lines in a narrow rail: the name and its switch, then the stage's preset picker full width. */
.stage > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 0; }
.stage > summary .stagename { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); font-size: 12.5px; order: 1; }
.stage > summary .switch { margin: 0; flex: 0 0 96px; width: 96px; order: 4; }
.stage > summary .stagepick { flex: 1 1 100%; order: 5; min-width: 0; max-width: none; font: inherit; font-size: 11.5px; color: var(--muted); background: var(--panel); border: 1px solid var(--line-2); border-radius: 3px; padding: 3px 6px; }
.stage.on > summary .stagepick { color: var(--text); }
.stage > summary .switch .name, .stage > summary .switch .val, .stage > summary .switch .back { display: none; }
/* The preset tools: one row of small buttons, and the inline name box or target picker under it. */
.tools .row { display: flex; flex-wrap: wrap; gap: 6px; }
.tools .row.inline { margin-top: 6px; }
.tools .row.inline input, .tools .row.inline select { flex: 1; min-width: 0; font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--amber); border-radius: 3px; padding: 5px 8px; }
.tools .row.inline[hidden] { display: none; }
.tools button[hidden] { display: none; }
.pick.tools { grid-template-columns: 64px 1fr; }
.stage > summary > .tools { flex: 1 1 100%; order: 6; }
.stage > summary > .tools button { padding: 4px 8px; font-size: 11.5px; }
/* The Movement tree's root box hides its own summary: the stage header is its name. */
.stage > .group.treeroot > summary { display: none; }
.stage > .group.treeroot { margin: 0; }
.stage > .group.treeroot > .group { margin-left: 0; padding-left: 0; border-left: 0; }
.stage > .group > summary { margin-top: 8px; }
.stage > .group:last-child { margin-bottom: 8px; }
.pick { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 8px; margin: 0 0 8px; }
.pick button { padding: 5px 9px; }
.pick .row { display: flex; gap: 6px; grid-column: 2 / -1; }
.pick button[hidden] { display: none; }
.pick span { color: var(--muted); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; }
.pick select { width: 100%; font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 3px; padding: 6px 8px; }
.search { width: 100%; margin: 0 0 8px; font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 3px; padding: 6px 8px; }
.search::placeholder { color: var(--dim); }
.group .group { margin-left: 10px; padding-left: 8px; border-left: 1px solid var(--line); }
.status { margin: 6px 0 10px; color: var(--dim); font-size: 11px; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; min-height: 1.4em; }

.rail { border-left: 1px solid var(--line); background: var(--panel); overflow-y: auto; padding: 12px 14px 28px; }
.rail h2, .rail h3 { margin: 0 0 8px; font-size: 10.5px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.rail h3 { margin-top: 14px; }
.rail section + section { margin-top: 16px; }

.dial { display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 2px 8px; margin: 7px 0; cursor: pointer; }
/* Only: a small dim word beside the readout that lights on hover; hidden where it has no meaning. */
.dial .only { padding: 0 4px; font-size: 10px; line-height: 16px; color: var(--dim); background: transparent; border-color: transparent; border-radius: 3px; }
.dial .only:hover, .dial .only.on { color: var(--amber); border-color: var(--amber-dim); background: #283944; }
.dial .only[hidden] { display: none; }
.stage > summary > .zero { order: 3; flex: 0 0 auto; padding: 3px 8px; font-size: 11px; }
.back { padding: 0; width: 18px; height: 18px; line-height: 16px; border-radius: 9px; font-size: 13px; color: var(--amber); background: transparent; border-color: transparent; opacity: 0; transform: rotate(-90deg); transition: opacity 0.25s, transform 0.35s cubic-bezier(.16,.84,.3,1); pointer-events: none; }
.back.show { opacity: 1; transform: rotate(0deg); pointer-events: auto; }
.back:hover { border-color: var(--amber-dim); background: #283944; }
/* A tree's wheel sits after its name, a stage's between its name and its switch. */
.group > summary > .back { margin-left: 2px; }
.stage > summary > .back { order: 2; }
.dial .name { color: var(--text); }
.dial .val { color: var(--muted); font-variant-numeric: tabular-nums; cursor: text; border-bottom: 1px dotted transparent; }
.dial .val:hover { color: var(--text); border-bottom-color: var(--line-2); }
.dial .typein { width: 7.5em; font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--amber); border-radius: 3px; padding: 1px 5px; text-align: right; font-variant-numeric: tabular-nums; }
.dial input[type=range] { grid-column: 1 / -1; width: 100%; margin: 0; height: 18px; accent-color: var(--amber); cursor: pointer; }
.dial.choice .val { display: none; }
/* Doing's readout stays: it is live, the stance or the action that has the body right now. */
.dial.choice .val.live { display: inline; color: var(--amber); cursor: default; border-bottom: 0; }
/* Choices flow onto more rows when their words need the room; no label is ever cut. */
.seg { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 1px; padding: 1px; border: 1px solid var(--line-2); border-radius: 3px; background: var(--line-2); overflow: hidden; }
.seg button { flex: 1 1 auto; min-width: 0; border: 0; border-radius: 2px; background: var(--panel-2); padding: 5px 6px; font-size: 11.5px; white-space: nowrap; }
.seg button.on { background: #283944; color: var(--amber); }
.settings-transfer { display:grid; gap:6px; margin-top:8px; width:100%; }
.settings-transfer textarea { box-sizing:border-box; width:100%; resize:vertical; background:var(--panel-2); color:var(--text); border:1px solid var(--line-2); border-radius:3px; padding:8px; font:12px/1.5 var(--ui-font); }
.dial-menu { grid-column:1/-1; width:100%; min-width:0; padding:9px 10px; font:13px "Segoe UI",sans-serif; background:var(--panel-2); color:var(--text); border:1px solid var(--line-2); border-radius:4px; }
.dial[data-unavailable]::after { content:attr(data-unavailable); grid-column:1/-1; font-size:11px; color:var(--dim); }
.hint { color: var(--dim); font-size: 11px; margin: 14px 0 0; line-height: 1.55; }
.hint b { color: var(--muted); font-weight: 500; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto minmax(52vh, 1fr) auto; height: auto; min-height: 100vh; }
  .bar { flex-wrap: wrap; height: auto; padding: 8px 10px; gap: 8px; }
  .brand .sub { display: none; }
  .stage { min-height: 52vh; }
  .rail { border-left: 0; border-top: 1px solid var(--line); }
}
/* The tools away (H, and ?ui=0): tape-ui.js tweens the grid's tracks and slides the bar up and the
   rail out; these rules hold the ends and clip whatever is on its way out. */
.app { overflow: hidden; }
body.tools-easing .bar, body.tools-easing .rail { will-change: transform, opacity; }
body.tools-hidden .bar, body.tools-hidden .rail { visibility: hidden; pointer-events: none; }
@media (max-width: 900px) {
  body.tools-hidden .app { grid-template-rows: 1fr; height: 100vh; }
  body.tools-hidden .bar, body.tools-hidden .rail { display: none; }
}
/* The deck's own word on the picture: every notice lands here in amber, eases up, holds, and eases away. */
.toast { position: absolute; left: 50%; bottom: 22px; z-index: 9; max-width: min(78%, 520px); transform: translate(-50%, 8px); padding: 7px 12px 7px 14px; border: 1px solid #ffbd4d3a; border-left: 3px solid #ffbd4d; border-radius: 4px; background: #14120bd9; color: #ffd98f; text-shadow: 0 0 6px #ffbd4d55; font: 12.5px/1.45 var(--ui-font); white-space: normal; text-align: center; opacity: 0; pointer-events: none; transition: opacity 0.35s ease, transform 0.5s cubic-bezier(.16,.84,.3,1); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
/* The shutter: a photo whites the picture for an instant and lets it back in over a third of a second. */
.ff-flash { position: absolute; inset: 0; z-index: 8; background: #fff8ec; opacity: 0; pointer-events: none; transition: opacity 0.35s ease-out; }
.ff-flash.on { opacity: .85; transition: none; }

#tape.free-look { cursor:crosshair; }
