/* Flashmob 1518 — macOS-style viewer. Follows the system appearance. */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --window: #ececec;
  --pane: rgba(255, 255, 255, 0.72);
  --pane-solid: #f6f6f6;
  --row-alt: rgba(0, 0, 0, 0.025);
  --sep: rgba(0, 0, 0, 0.1);
  --label: rgba(0, 0, 0, 0.85);
  --label-2: rgba(0, 0, 0, 0.5);
  --label-3: rgba(0, 0, 0, 0.3);
  --control: rgba(0, 0, 0, 0.06);
  --control-on: #ffffff;
  --accent: #007aff;
  --clip: rgba(0, 122, 255, 0.55);
  --clip-edge: rgba(0, 90, 200, 0.6);
  --clip-sel: #007aff;
  --music: #34c759;
  --head: #ff3b30;
  --warn: #ff9500;
  --stage: #000;
  --shadow: 0 0.5px 0 rgba(0,0,0,.06), 0 8px 30px rgba(0,0,0,.18);
  --lbl: 168px;
  --row: 24px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --window: #1e1e1e;
    --pane: rgba(40, 40, 42, 0.72);
    --pane-solid: #262628;
    --row-alt: rgba(255, 255, 255, 0.025);
    --sep: rgba(255, 255, 255, 0.09);
    --label: rgba(255, 255, 255, 0.86);
    --label-2: rgba(255, 255, 255, 0.55);
    --label-3: rgba(255, 255, 255, 0.28);
    --control: rgba(255, 255, 255, 0.08);
    --control-on: rgba(255, 255, 255, 0.22);
    --accent: #0a84ff;
    --clip: rgba(10, 132, 255, 0.42);
    --clip-edge: rgba(80, 160, 255, 0.5);
    --clip-sel: #0a84ff;
    --music: #30d158;
    --head: #ff453a;
    --warn: #ff9f0a;
    --shadow: 0 0 0 0.5px rgba(255,255,255,.06), 0 12px 40px rgba(0,0,0,.55);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 13px/1.38 var(--font); letter-spacing: -0.003em; color: var(--label); background: var(--window);
  display: flex; flex-direction: column; height: 100vh; height: 100dvh;
  -webkit-font-smoothing: antialiased; -webkit-user-select: none; user-select: none;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: default; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; border-radius: 6px; }
[hidden] { display: none !important; }
/* viewers get the picture, one play button and the timeline; the line-up page (?edit) gets the rest */
body:not(.edit) .edit-only, body:not(.edit) .tile .tag { display: none !important; }

/* toolbar */
.toolbar {
  flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  height: 52px; padding: 0 16px; background: var(--pane); border-bottom: 0.5px solid var(--sep);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  position: relative; z-index: 2;
}
.toolbar h1 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: -0.01em; }

/* segmented control */
.segmented { display: inline-flex; padding: 2px; gap: 2px; border-radius: 7px; background: var(--control); }
.segmented button { padding: 3px 14px; border-radius: 5px; font-size: 12px; font-weight: 500; color: var(--label); line-height: 18px; transition: background-color .15s; }
.segmented button:hover { background: color-mix(in srgb, var(--control) 60%, transparent); }
.segmented button.on { background: var(--control-on); box-shadow: 0 0.5px 1px rgba(0,0,0,.18), 0 0 0 0.5px rgba(0,0,0,.04); }
.segmented.small button { padding: 1px 10px; min-width: 30px; }
.segmented .sub { margin-left: 6px; color: var(--label-2); font-weight: 400; }

main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

/* stage: the picture floats on a glow of its own colours */
#stage { position: relative; flex: 1 1 0; min-height: 180px; display: grid; place-items: center; padding: 20px 24px 8px; overflow: hidden; }
#ambient {
  position: absolute; inset: -10%; width: 120%; height: 120%; filter: blur(60px) saturate(140%);
  opacity: 0; transition: opacity 1.2s ease; pointer-events: none;
}
#stage.lit #ambient { opacity: .55; }
@media (prefers-color-scheme: light) { #stage.lit #ambient { opacity: .4; } }
#screen {
  position: relative; height: 100%; max-width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden;
  background: var(--stage); box-shadow: var(--shadow);
}
.toolbar-end { justify-self: end; }
#wall { position: absolute; inset: 20px 24px 8px; }
#wall-empty { position: absolute; inset: 0; color: var(--label-2); }
.tile {
  position: absolute; padding: 0; border-radius: 10px; overflow: hidden; background: var(--stage);
  box-shadow: var(--shadow);
  transition: left .35s cubic-bezier(.2,.8,.2,1), top .35s cubic-bezier(.2,.8,.2,1), width .35s cubic-bezier(.2,.8,.2,1), height .35s cubic-bezier(.2,.8,.2,1), box-shadow .15s, transform .15s;
}
.tile.main video { object-fit: contain; }
.tile.main { z-index: 1; }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile.focus { box-shadow: 0 0 0 2.5px var(--accent), var(--shadow); }
.tile .tag {
  position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 5px; font-size: 11.5px; font-weight: 500; color: #fff;
  background: rgba(30,30,30,.45); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.tile.focus .tag { background: var(--accent); }
#screen video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: rgba(255,255,255,.55); font-size: 15px; }
#label {
  position: absolute; left: 12px; top: 12px; padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 500; color: #fff;
  background: rgba(30,30,30,.45); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
#note {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); padding: 7px 16px; border-radius: 10px;
  font-size: 12.5px; font-weight: 500; color: var(--label); background: var(--pane); box-shadow: var(--shadow);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  animation: toast .25s ease-out;
}
@keyframes toast { from { opacity: 0; transform: translate(-50%, 6px); } }

/* transport */
#controls { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 6px 16px 10px; position: relative; z-index: 1; }
.hud { grid-column: 2; display: flex; align-items: center; gap: 12px; }
#controls .segmented { grid-column: 3; justify-self: end; }
#edit-tools { grid-column: 1; grid-row: 1; display: flex; gap: 10px; align-items: center; color: var(--label-2); font-size: 11.5px; min-width: 0; }
#edit-tools button { padding: 3px 12px; border-radius: 6px; background: var(--accent); color: #fff; font-weight: 500; }
.round { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--control); color: var(--label); transition: background-color .15s, transform .1s; }
.round:hover { background: color-mix(in srgb, var(--label) 14%, transparent); }
.round:active { transform: scale(.94); }
.round svg { width: 15px; height: 15px; fill: currentColor; }
#play .i-pause, #play.playing .i-play { display: none; }
#play.playing .i-pause { display: block; }
#song { font-size: 12px; color: var(--music); font-variant-numeric: tabular-nums; min-width: 110px; }
#time { font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--label-2); min-width: 64px; }

/* timeline */
#timeline {
  flex: none; position: relative; overflow: hidden; touch-action: none;
  background: var(--pane-solid); border-top: 0.5px solid var(--sep); padding-bottom: 6px;
}
#ruler, .lane { display: flex; height: var(--row); }
#ruler { height: 26px; border-bottom: 0.5px solid var(--sep); cursor: col-resize; }
.lbl {
  width: var(--lbl); flex: none; display: flex; align-items: center; padding: 0 12px 0 16px; gap: 8px;
  font-size: 12px; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-right: 0.5px solid var(--sep);
}
.lane .lbl::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--label-3); transition: background-color .15s; }
.lane[data-cam="music"] .lbl::before { background: var(--music); }
.trk { flex: 1; position: relative; overflow: hidden; }
.lane:nth-child(even) { background: var(--row-alt); }
.lane.sel { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.lane.sel .lbl { color: var(--label); font-weight: 500; }
.lane.sel .lbl::before { background: var(--accent); }
.tick { position: absolute; top: 0; bottom: 0; padding: 7px 0 0 5px; border-left: 0.5px solid var(--sep); font-size: 10.5px; font-variant-numeric: tabular-nums; color: var(--label-2); white-space: nowrap; }
.blk {
  position: absolute; top: 4px; bottom: 4px; min-width: 2px; border-radius: 4px; overflow: hidden;
  background: var(--clip); box-shadow: inset 0 0 0 0.5px var(--clip-edge); transition: background-color .15s;
}
.lane.sel .blk { background: var(--clip-sel); box-shadow: none; }
.blk.music { background: color-mix(in srgb, var(--music) 55%, transparent); box-shadow: inset 0 0 0 0.5px var(--music); }
.blk.missing { background: repeating-linear-gradient(135deg, var(--control) 0 3px, transparent 3px 6px); box-shadow: inset 0 0 0 0.5px var(--sep); }
.blk.lowconf { box-shadow: inset 0 0 0 1.5px var(--warn); }
.blk.picked { box-shadow: inset 0 0 0 2px #fff, 0 0 0 1px var(--accent); }
.blk canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .75; pointer-events: none; mix-blend-mode: soft-light; }
#playhead { position: absolute; top: 0; bottom: 6px; width: 1px; margin-left: -0.5px; background: var(--head); pointer-events: none; }
#playhead .cap { position: absolute; top: 3px; left: -5px; width: 11px; height: 14px; border-radius: 3px 3px 6px 6px; background: var(--head); box-shadow: 0 1px 2px rgba(0,0,0,.3); }

@media (max-width: 700px) {
  :root { --lbl: 100px; --row: 22px; }
  .toolbar { grid-template-columns: 1fr auto; height: auto; padding: 10px 16px; }
  .toolbar-end { display: none; }
  #stage { padding: 12px 16px 6px; }
  .lbl { padding-left: 12px; }
  #edit-tools { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* compact timeline for viewers (the line-up page keeps the taller rows for waveforms) */
body:not(.edit) { --row: 14px; --lbl: 84px; }
body:not(.edit) #ruler { height: 18px; }
body:not(.edit) .tick { padding-top: 3px; font-size: 9.5px; }
body:not(.edit) .lbl { font-size: 10.5px; padding: 0 8px 0 10px; gap: 6px; }
body:not(.edit) .lane .lbl::before { width: 5px; height: 5px; }
body:not(.edit) .lane { margin: 0; }
body:not(.edit) .blk { top: 2.5px; bottom: 2.5px; border-radius: 3px; }
body:not(.edit) #playhead .cap { top: 2px; width: 9px; height: 11px; left: -4px; }
body:not(.edit) #timeline { padding-bottom: 4px; }
body:not(.edit) #controls { padding: 4px 16px 6px; }
@media (max-width: 700px) { body:not(.edit) { --row: 13px; --lbl: 70px; } }

/* viewers: no header, videos take every pixel above the controls */
body:not(.edit) .toolbar { display: none; }
body:not(.edit) #stage { padding: 0; }
body:not(.edit) #wall { inset: 8px; }

/* collapse button and folded timeline */
#fold { grid-column: 3; grid-row: 1; justify-self: end; }
.small-round { width: 28px; height: 28px; }
.small-round svg { width: 14px; height: 14px; transition: transform .25s ease; }
body.folded #fold svg { transform: rotate(180deg); }
body.folded #lanes { display: none; }
body.edit #fold { display: none; }
#controls .segmented { grid-column: 3; grid-row: 1; }

/* slim play bar for viewers */
body:not(.edit) #controls { padding: 2px 12px; }
body:not(.edit) #play { width: 26px; height: 26px; }
body:not(.edit) #play svg { width: 12px; height: 12px; }
body:not(.edit) .small-round { width: 22px; height: 22px; }
body:not(.edit) .small-round svg { width: 12px; height: 12px; }

/* the day, in the corner left of the time strip */
#ruler .lbl { font-size: 10.5px; font-weight: 600; color: var(--label); font-variant-numeric: tabular-nums; cursor: default; }
