:root {
    --bg: #15171a;
    --panel: #1d2024;
    --line: #2e3238;
    --fg: #d8dbe0;
    --muted: #8a919b;
    --accent: #5aa9ff;
    --bad: #7a2630;
    --sz: min(512px, calc((100vw - 420px) / 2));
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: var(--bg);
    color: var(--fg);
    font: 13px/1.4 system-ui, sans-serif;
}

h1 {
    font-size: 15px;
    margin: 0;
}

h2 {
    font-size: 16px;
    margin: 0;
    font-family: ui-monospace, monospace;
}

h3 {
    font-size: 13px;
    margin: 18px 0 6px;
}

.muted {
    color: var(--muted);
    font-weight: normal;
}

.mono {
    font-family: ui-monospace, monospace;
}

button,
select,
input {
    background: var(--panel);
    color: var(--fg);
    border: 1px solid var(--line);
    border-radius: 4px;
    font: inherit;
}

button {
    padding: 3px 10px;
    cursor: pointer;
}

button:hover {
    border-color: var(--accent);
}

label {
    white-space: nowrap;
}

#side {
    width: 380px;
    flex: none;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--line);
    background: var(--panel);
}

#side header {
    padding: 10px 12px 4px;
}

#side .row {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    padding: 4px 12px;
}

#filter {
    width: 100%;
    padding: 4px 6px;
}

#sort {
    max-width: 230px;
}

#totalsBox {
    margin: 6px 12px;
    overflow-x: auto;
}

#totals {
    font-size: 10.5px;
}

#totals th,
#totals td {
    padding: 1px 4px;
}

#list {
    list-style: none;
    margin: 4px 0 0;
    padding: 0;
    overflow-y: auto;
    flex: 1;
    border-top: 1px solid var(--line);
}

#list li {
    display: grid;
    grid-template-columns: 62px 44px 1fr 54px;
    gap: 6px;
    align-items: center;
    padding: 2px 12px;
    cursor: pointer;
    font-family: ui-monospace, monospace;
    font-size: 12px;
}

#list li:hover {
    background: #262a30;
}

#list li.sel {
    background: #23364d;
}

#list .bar {
    height: 6px;
    background: linear-gradient(90deg, #3d7a52, #b8a03a, #b8453a);
    border-radius: 3px;
    width: var(--w);
}

#list .v {
    text-align: right;
}

main {
    flex: 1;
    overflow-y: auto;
    padding: 12px 18px 40px;
}

#head {
    display: flex;
    align-items: center;
    gap: 10px;
}

#views {
    display: flex;
    gap: 14px;
    margin-top: 10px;
    flex-wrap: wrap;
}

figure {
    margin: 0;
}

figcaption {
    margin-top: 4px;
    color: var(--muted);
    max-width: var(--sz);
}

.stage {
    position: relative;
    width: var(--sz);
    height: var(--sz);
    background: #0c0d0f;
    border: 1px solid var(--line);
}

.stage video,
.stage canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

#transport {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    max-width: calc(2 * var(--sz) + 14px);
}

#play {
    width: 44px;
}

#track {
    position: relative;
    flex: 1;
}

#slider {
    width: 100%;
}

#editTick {
    position: absolute;
    top: -4px;
    width: 2px;
    height: 26px;
    background: #ff5a5a;
    pointer-events: none;
}

#layers {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 10px;
    align-items: center;
}

#layers .sw {
    display: inline-block;
    vertical-align: middle;
}

table.grid {
    border-collapse: collapse;
}

table.grid th,
table.grid td {
    border: 1px solid var(--line);
    padding: 2px 7px;
    text-align: right;
    white-space: nowrap;
}

table.grid th {
    background: var(--panel);
    font-weight: 600;
}

table.grid td.l,
table.grid th.l {
    text-align: left;
}

table.grid tr.hl td {
    background: #23364d;
}

td.bad {
    background: var(--bad);
}

td.prior {
    color: var(--muted);
    font-style: italic;
}

.scroll {
    overflow-x: auto;
}

.help {
    margin-top: 18px;
}

.dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 4px;
}