:root {
  --yellow: #ffd21e;
  --ink: #0b0b0c;
  --paper: #f3efe6;
  /* Player chrome palette, apart from the film (its yellow stays in the
     image and the filmstrips): active / toggled / focus states, the current
     position (playhead, knob, current shot), text on either. */
  --ui-accent: #d8d8d8;
  --ui-accent-strong: #f5f5f5;
  --ui-ink: #111;
  --ui-bar: #151517;
  --ui-line: #2c2c30;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #111; overflow: hidden; overscroll-behavior: none; }
body.render #controls { display: none; }

#viewport { position: absolute; inset: 0 0 64px 0; overflow: hidden; }
body.render #viewport { inset: 0; }
#stage { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; overflow: hidden; transform-origin: 0 0; background: var(--ink); }

/* Layers are stacked by DOM order only (no z-index) so blend modes in
   #front can blend with the WebGL canvas underneath. */
#bg, #wipe, #back, #front, #flash, #hud, #grain { position: absolute; inset: 0; }
#gl { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; }
#bg.blueprint {
  background-image:
    linear-gradient(rgba(11, 11, 12, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 11, 12, 0.045) 1px, transparent 1px);
  background-size: 60px 60px;
  background-position: -1px -1px;
}
#flash { background: var(--paper); opacity: 0; pointer-events: none; }
.bar { position: absolute; left: 0; right: 0; height: 0; background: #000; }
.bar.top { top: 0; }
.bar.bottom { bottom: 0; }
#grain { opacity: 0.06; mix-blend-mode: overlay; pointer-events: none; }
.ld-overlay { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; background: var(--ink); transition: opacity 0.3s ease; }
.ld-overlay.ld-out { opacity: 0; pointer-events: none; }
body.render .ld-overlay { display: none; }
/* Take switch: the frame being loaded, from the frames sprite, instead of the ring */
.ld-still { position: absolute; background-repeat: no-repeat; }
.ld-resume .ld-ring { display: none; }
.ld-ring { width: 56px; height: 56px; overflow: visible; animation: ld-spin 1.1s linear infinite; }
.ld-ring circle { fill: none; stroke-width: 2; }
.ld-track { stroke: var(--paper); opacity: 0.12; }
.ld-arc { stroke: var(--ui-accent-strong); stroke-linecap: round; stroke-dasharray: 0.12 1; transition: stroke-dasharray 0.25s ease; }
@keyframes ld-spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .ld-ring { animation-duration: 4s; } }

.scene { position: absolute; inset: 0; display: none; }
.abs { position: absolute; }
.svg { position: absolute; left: 0; top: 0; overflow: visible; }

.anton { font-family: 'Anton', sans-serif; text-transform: uppercase; line-height: 0.86; letter-spacing: -0.005em; }
.grot { font-family: 'DM Sans Variable', sans-serif; font-weight: 700; letter-spacing: -0.04em; }
/* Mixed-case copy uses the Reachy Mini website face (DM Sans), like .grot. */
.serif { font-family: 'DM Sans Variable', sans-serif; font-weight: 500; letter-spacing: -0.03em; }
.mono { font-family: 'JetBrains Mono', monospace; }
.ink { color: var(--ink); }
.yellow { color: var(--yellow); }
.white { color: var(--paper); }

/* Lyric cards */
.card { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.card .row { display: flex; justify-content: center; gap: 0.17em; white-space: nowrap; }
.card .row:has(.ch) { gap: 0; }
.card.right { align-items: flex-end; text-align: right; padding-right: 130px; }
.card.right .row { justify-content: flex-end; }
.card .w { display: inline-block; position: relative; transform-origin: 50% 60%; }
/* Filled but opaque: an outline filter (mergedOutline) traces the ghost. */
.card.ghost { color: var(--ink); }
/* HUD */
#hud { font-size: 17px; letter-spacing: 0.14em; text-transform: uppercase; line-height: 1.45; pointer-events: none; }
#hud > div { position: absolute; }
.h-tl { top: 38px; left: 52px; }
.h-tr { top: 38px; right: 52px; font-variant-numeric: tabular-nums; }
.h-bl { bottom: 46px; left: 52px; }
.h-br { bottom: 46px; right: 52px; }
#hud .prog { left: 52px; right: 52px; bottom: 30px; height: 2px; background: currentColor; opacity: 0.35; }
#hud .prog i { display: block; height: 100%; background: currentColor; transform-origin: left; }

/* Scene type used by several folders (each scene's own rules are in its
   folder's style.css, linked after this file in edit order). */
.mw { display: inline-block; overflow: hidden; padding: 0.06em 0.02em 0.14em; margin: -0.06em -0.02em -0.14em; }
.wi { display: inline-block; }
.caret { color: var(--yellow); font-style: normal; }
.ch { display: inline-block; }
.chorus { font-size: 340px; line-height: 0.82; }

/* Preview controls */
/* One bar in both modes: the editor view only adds the timeline above the
   row (row 1) and a chapter bar (#chapters) where the viewer's timeline was,
   so T moves nothing in the row. One column per row item (play, loop,
   volume, timeline / chapters, time, chapter, right); the row sticks to the
   bottom while the open / close animation reveals the timeline. */
#controls { position: absolute; left: 0; right: 0; bottom: 0; min-height: 64px; display: grid; grid-template-columns: auto auto auto minmax(0, 1fr) auto auto auto; align-content: end; align-items: center; --bar-gap: 16px; padding: 0 18px; background: linear-gradient(to top, var(--ui-bar) 64px, var(--ui-line) 64px 65px, #0b0b0c 65px); color: #ddd; font-size: 13px; border-top: 1px solid #222; user-select: none; }
#play, #mute, #tlmode { box-sizing: border-box; height: 34px; min-width: 40px; padding: 0 12px; display: inline-flex; align-items: center; gap: 8px; background: #1c1c1c; color: #ddd; border: 1px solid #333; border-radius: 6px; font: inherit; text-decoration: none; white-space: nowrap; cursor: pointer; transition: color 0.12s, border-color 0.12s; }
#mute:hover, #tlmode:hover { color: #fff; border-color: #555; }
#controls #play { width: 34px; min-width: 0; padding: 0; justify-content: center; background: var(--ui-accent); color: var(--ui-ink); border: 0; transition: background-color 0.12s; }
#controls #play:hover { background: var(--ui-accent-strong); }
#play:focus-visible, #mute:focus-visible, #tlmode:focus-visible, #volume:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 2px; }
#controls svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
/* Right cluster: Editor view, fullscreen (Share is in the top bar). */
#right { margin-left: auto; gap: 10px; }
/* Skimming (main.js): a strip frame over the film, and what the monitor shows. */
.skim { display: none; position: absolute; inset: 0; z-index: 50; background-repeat: no-repeat; pointer-events: none; }
.skim.on { display: block; }
.skim-chip { display: none; position: fixed; z-index: 15; transform: translateX(-50%); padding: 4px 8px; font-size: 11px; letter-spacing: 0.06em; white-space: nowrap; color: var(--ui-ink); background: var(--ui-accent); border-radius: 4px; box-shadow: 0 4px 16px #0008; pointer-events: none; }
.skim-chip.on { display: block; }
.skim-chip span { opacity: 0.65; }
/* Monitor strip (player/strip.js), editor view: readouts under the picture
   (main.js fit places it; 29 px tall, STRIP_H: a 24 px line and a clear
   band). Fixed value widths, tabular digits: nothing moves as they tick. A
   narrow picture hides data-drop 1, then 2, then 3. */
#strip { position: absolute; left: 0; top: 0; z-index: 2; height: 29px; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 0 10px 5px; font-size: 11px; line-height: 23px; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ui-accent); background: linear-gradient(var(--ui-bar) 23px, transparent 0); border-top: 1px solid var(--ui-line); container-type: inline-size; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity 0.12s, visibility 0s 0.12s; }
#strip.on { opacity: 1; visibility: visible; transition: opacity 0.18s 0.12s; }
body.render #strip { display: none; }
#strip .ms-l, #strip .ms-r { display: flex; align-items: center; gap: 16px; min-width: 0; }
#strip .ms-l { flex: 1 1 auto; }
#strip .ms-r { flex: none; }
#strip .ms-f { display: inline-flex; align-items: baseline; gap: 7px; min-width: 0; pointer-events: auto; }
#strip .ms-f b { font-weight: 400; font-size: 9.5px; letter-spacing: 0.1em; color: #6c6c70; }
#strip .ms-f .v { display: inline-block; overflow: hidden; text-overflow: ellipsis; }
#strip .ms-r .v { text-align: right; }
#strip .ms-scene, #strip .ms-cut { flex: none; }
#strip .ms-take { flex: 0 1 auto; }
#strip .ms-take .v { min-width: 0; text-transform: none; }
#strip .ms-f.empty b { visibility: hidden; }
#strip .ms-take.other .v { color: var(--ui-accent-strong); text-decoration: underline dotted #6c6c70; text-underline-offset: 3px; }
/* Skimming / a rate but 1x: a small pill, its slot always there. */
#strip .ms-state .v { padding: 0 5px; line-height: 16px; border-radius: 3px; font-weight: 700; text-align: center; color: var(--ui-ink); background: var(--ui-accent); }
#strip .ms-state.empty .v { background: none; }
@container (max-width: 620px) { #strip [data-drop='1'] { display: none; } }
@container (max-width: 470px) { #strip [data-drop='2'] { display: none; } }
@container (max-width: 360px) { #strip [data-drop='3'] { display: none; } }
/* "Copied" confirmation of the share menu (main.js). */
.toast { position: fixed; z-index: 40; left: 50%; bottom: 84px; padding: 7px 12px; font-size: 12px; letter-spacing: 0.04em; color: var(--ui-ink); background: var(--ui-accent); border-radius: 6px; box-shadow: 0 6px 24px #000a; opacity: 0; transform: translate(-50%, 6px); transition: opacity 0.15s, transform 0.15s; pointer-events: none; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.err { color: #fff; background: #e5483a; }
/* Volume: mute button + short slider, next to play */
#vol { gap: 8px; }
#controls #mute { width: 34px; min-width: 0; padding: 0; justify-content: center; }
#mute .spk { fill: currentColor; stroke: none; }
#mute .x, #mute[aria-pressed='true'] .w1, #mute[aria-pressed='true'] .w2, #mute[data-level='0'] .w1, #mute[data-level='0'] .w2, #mute[data-level='1'] .w2 { display: none; }
#mute[aria-pressed='true'] .x, #mute[data-level='0'] .x { display: inline; }
/* Grey fill at rest, so it doesn't read as a second progress bar next to the timeline */
#volume { --fill: 100%; --fill-color: #9a9a9a; width: 72px; height: 18px; margin: 0; -webkit-appearance: none; appearance: none; background: none; cursor: pointer; border-radius: 3px; }
#volume::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--fill-color) var(--fill), #333 var(--fill)); }
#volume::-moz-range-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--fill-color) var(--fill), #333 var(--fill)); }
#volume::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4px; border: 0; border-radius: 50%; background: #ddd; transition: transform 70ms, background-color 70ms; }
#volume::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: #ddd; }
#vol:hover #volume, #volume:focus-visible, #volume:active { --fill-color: var(--ui-accent); }
#volume:hover::-webkit-slider-thumb, #volume:active::-webkit-slider-thumb { transform: scale(1.2); background: #fff; }
@media (max-width: 1000px) { #controls #volume { display: none; } }
#controls { transition: opacity 0.35s, transform 0.35s; }
body.idle { cursor: none; }
body.idle #controls { opacity: 0; transform: translateY(10px); pointer-events: none; }
#controls > * { grid-row: 2; }
#timeline, #chapters { min-width: 0; }
/* Gaps as margins: a hidden item leaves no empty grid gap behind. */
#controls > :where(:not(#play, #splitter)) { margin-left: var(--bar-gap); }
#controls.tl-open #timeline { margin-left: 0; }
#chapters { display: none; }
#controls.tl-open #chapters { display: block; }
#controls.tl-open { padding-top: 6px; }
#controls.tl-open #tlmode { color: var(--ui-accent); border-color: var(--ui-accent); }
/* Shortcut keycap: depth is a shadow, not a border, so pressing it doesn't move the label */
#controls #tlmode { gap: 9px; padding-right: 8px; }
#tlmode kbd { box-sizing: border-box; width: 18px; height: 17px; margin-top: -2px; display: inline-grid; place-items: center; font-family: inherit; font-size: 10px; font-weight: 500; line-height: 1; color: #9a9a9a; background: #262626; border: 1px solid #3a3a3a; border-radius: 4px; box-shadow: 0 2px 0 #333; transition: transform 70ms, box-shadow 70ms, color 70ms, background-color 70ms, border-color 70ms; }
#tlmode.down kbd { transform: translateY(2px); box-shadow: 0 0 0 #333; color: #fff; background: #303030; border-color: #4a4a4a; }
#controls.tl-open #tlmode kbd { color: var(--ui-accent); background: #2a2a2a; border-color: #5a5a5a; box-shadow: 0 2px 0 #404040; }
#controls.tl-open #tlmode.down kbd { box-shadow: 0 0 0 #404040; color: #fff; background: #363636; border-color: #7a7a7a; }
#controls > :where(:not(#timeline, #chapters, #splitter)) { flex: none; height: 34px; margin-block: 15px; display: inline-flex; align-items: center; }
/* As wide as the editor view's timecode, so the mode's format moves nothing. */
#time { width: 19ch; font-variant-numeric: tabular-nums; }
/* A fixed width: a longer name doesn't shift the row (it truncates). */
#controls > #chapter { display: block; width: 190px; line-height: 34px; color: var(--ui-accent); letter-spacing: 0.08em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) {
  #controls { --bar-gap: 12px; padding: 0 12px; }
  #controls > #chapter, #controls #tlmode, #controls #volume { display: none; }
  /* No editor view here: the viewer's m:ss / m:ss, and the timeline on its
     own row above the buttons, full width. */
  #time { width: auto; }
  #controls #timeline { grid-row: 1; grid-column: 1 / -1; margin: 12px 0 0; }
}

/* Editor view: the timeline (as tall as its lanes) over the row, on its own
   surface above the row's hairline; the film monitor above takes the rest
   (main.js fit). */
#controls.tl-open #timeline { grid-area: 1 / 1 / 2 / -1; --tl-shot: 76px; --tl-music-h: 56px; padding-bottom: 8px; }
/* Short windows (a phone in landscape): shorter lanes, so the monitor keeps a picture. */
@media (max-height: 500px) { #controls.tl-open #timeline { --tl-shot: 40px; --tl-music-h: 28px; } }
/* The splitter along the timeline's top edge (main.js): drag to share the
   height between the film and the takes lane. */
#controls:not(.tl-open) > #splitter { display: none; }
#controls.tl-open #splitter { display: block; position: absolute; z-index: 5; left: 0; right: 0; top: -6px; height: 11px; margin: 0; grid-area: auto; cursor: row-resize; touch-action: none; }
#splitter::before { content: ''; position: absolute; left: 0; right: 0; top: 5px; height: 1px; background: #333; transition: background-color 0.12s, height 0.12s, top 0.12s; }
#splitter::after { content: ''; position: absolute; left: 50%; top: 3px; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: #444; transition: background-color 0.12s; }
#splitter:hover::before, #splitter:focus-visible::before, body.splitting #splitter::before { top: 4px; height: 3px; background: var(--ui-accent); }
#splitter:hover::after, #splitter:focus-visible::after, body.splitting #splitter::after { background: var(--ui-accent); }
#splitter:focus { outline: none; }
body.splitting, body.splitting * { cursor: row-resize !important; user-select: none; }
/* Play prompt when the browser blocks a resumed playback (main.js). */
.play-hint { position: fixed; z-index: 20; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 26px 14px; font: inherit; font-size: 15px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ui-ink); background: var(--ui-accent); border: 0; border-radius: 10px; box-shadow: 0 10px 40px #000a; cursor: pointer; }
.play-hint small { font-size: 10px; font-weight: 500; letter-spacing: 0.04em; text-transform: none; opacity: 0.7; }
.play-hint:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
/* Fullscreen (main.js): black letterbox, the viewer bar over the film. */
#fs { box-sizing: border-box; width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; background: #1c1c1c; color: #ddd; border: 1px solid #333; border-radius: 6px; cursor: pointer; transition: color 0.12s, border-color 0.12s; }
#fs:hover { color: #fff; border-color: #555; }
#fs svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#fs:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 2px; }
#fs .out, #fs[aria-pressed='true'] .in { display: none; }
#fs[aria-pressed='true'] .out { display: inline; }
body.fs { background: #000; }
body.fs #controls:not(.tl-open) { background: linear-gradient(#0b0b0c00, #0b0b0ccc 45%); border-top-color: transparent; }
/* Review marker note (player/review.js), over the timeline at the playhead. */
.mk-input { position: fixed; z-index: 35; display: flex; flex-direction: column; gap: 5px; width: 320px; padding: 8px 10px 7px; background: #1c1c1c; border: 1px solid #3a3a3a; border-top: 2px solid var(--ui-accent); border-radius: 6px; box-shadow: 0 10px 32px #000b; }
.mk-input span { color: var(--ui-accent); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
.mk-input input { box-sizing: border-box; width: 100%; padding: 6px 8px; font: 13px 'DM Sans Variable', sans-serif; color: #f3efe6; background: #0e0e10; border: 1px solid #3a3a3a; border-radius: 4px; outline: none; }
.mk-input input:focus { border-color: #8a8a8a; }
.mk-input small { color: #8a8a8a; font-size: 9px; letter-spacing: 0.06em; }
/* Playback speed (player/speed.js): a small segmented control by the volume,
   and a badge over the film when it doesn't play at 1x. */
#speed { display: inline-flex; margin-left: 4px; border: 1px solid #333; border-radius: 6px; overflow: hidden; }
#speed button { height: 24px; min-width: 30px; padding: 0 6px; font: inherit; font-size: 11px; font-variant-numeric: tabular-nums; color: #8f8f8f; background: #161616; border: 0; border-left: 1px solid #333; cursor: pointer; transition: color 0.12s, background-color 0.12s; }
#speed button:first-child { border-left: 0; }
#speed button:hover { color: #fff; background: #242424; }
#speed button[aria-pressed='true'] { color: var(--ui-ink); background: var(--ui-accent); font-weight: 700; }
#speed button:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: -2px; }
.speed-one { display: none; }
/* Narrow bars (player/fit-controls.js), steps in order. */
#controls.fit-nochapter #chapter { display: none; }
#controls.fit-speed #speed button { display: none; }
#controls.fit-speed #speed .speed-one { display: inline-block; min-width: 40px; }
#controls.fit-nokeys kbd { display: none; }
#tlmode .ico { display: none; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
#controls.fit-icons #tlmode .lbl { display: none; }
#controls.fit-icons #tlmode .ico { display: inline; }
#controls.fit-icons #tlmode { padding: 0 10px; }
@media (max-width: 640px) { #speed { display: none; } }
.speed-badge { display: none; position: fixed; z-index: 16; transform: translateX(-100%); padding: 4px 9px; font-size: 13px; font-weight: 700; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; color: var(--ui-ink); background: var(--ui-accent); border-radius: 4px; box-shadow: 0 4px 16px #0008; pointer-events: none; }
.speed-badge.on { display: block; }
/* Loop (player/range.js): lit when on; a dot when an in / out range is set. */
#controls #loop { position: relative; box-sizing: border-box; width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; color: #9a9a9a; background: #1c1c1c; border: 1px solid #333; border-radius: 6px; cursor: pointer; transition: color 0.12s, border-color 0.12s; }
#loop svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
#loop:hover { color: #fff; border-color: #555; }
#controls #loop[aria-pressed='true'] { color: var(--ui-ink); background: var(--ui-accent); border-color: var(--ui-accent); }
#controls #loop[aria-pressed='true']:hover { background: var(--ui-accent-strong); border-color: var(--ui-accent-strong); }
#loop.ranged::after { content: ''; position: absolute; right: 4px; top: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--ui-accent); }
#loop.ranged[aria-pressed='true']::after { background: var(--ui-ink); }
#loop:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 2px; }
/* Range render progress (player/render-job.js, dev server only). */
.render-card { position: fixed; z-index: 35; right: 16px; bottom: 84px; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 6px 10px; min-width: 260px; max-width: 420px; padding: 9px 10px 10px 12px; font-size: 11px; letter-spacing: 0.04em; color: #ddd; background: #1c1c1c; border: 1px solid #333; border-radius: 8px; box-shadow: 0 8px 30px #000a; }
.render-card .rc-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.render-card .rc-bar { grid-column: 1 / -1; grid-row: 2; height: 3px; background: #333; border-radius: 2px; overflow: hidden; }
.render-card .rc-bar b { display: block; height: 100%; background: var(--ui-accent); transition: width 0.4s; }
.render-card[data-state='failed'] .rc-bar b { background: #e0776b; }
.render-card .rc-link { color: var(--ui-ink); background: var(--ui-accent); padding: 3px 8px; border-radius: 4px; text-decoration: none; white-space: nowrap; }
.render-card .rc-link[hidden] { display: none; }
.render-card .rc-close { padding: 0 4px; font: inherit; font-size: 14px; color: #8a8a8a; background: none; border: 0; cursor: pointer; }
.render-card .rc-close:hover { color: #fff; }
