.canvas-dock {
    position: absolute;
    left: max(18px, env(safe-area-inset-left));
    right: max(18px, env(safe-area-inset-right));
    bottom: max(18px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: end;
    gap: 8px;
    container-type: inline-size;
    pointer-events: none;
}

.canvas-dock > .hud {
    grid-area: 1 / 3;
    justify-self: end;
}

.time-bar {
    grid-area: 1 / 2;
    justify-self: center;
    display: flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    padding: 3px;
    font: 600 12px/1 system-ui, sans-serif;
    pointer-events: auto;
}

.time-bar button, .time-bar select {
    height: var(--lab-bar-control-height);
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.time-bar button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
}

.time-bar .playback-toggle {
    gap: 5px;
    width: 72px;
    background: #77b1f6;
    color: #08162b;
    font-weight: 700;
}

.time-bar button:enabled:hover, .time-bar select:hover { background-color: #25486e; }
.time-bar .playback-toggle:enabled:hover { background: #9acbff; }
.time-bar button:disabled { opacity: .45; cursor: default; }
.time-bar svg { width: 16px; height: 16px; }
.time-bar .playback-toggle svg { width: 14px; fill: currentColor; }

.time-bar [role="timer"] {
    min-width: 15ch;
    padding: 0 4px 0 8px;
    border-left: 1px solid rgba(150, 192, 242, .23);
    font: 11px/22px ui-monospace, monospace;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.time-bar select { padding: 0 3px; color-scheme: dark; }
.time-bar option { background: #0b1c31; color: #b9d4f2; }

@media (pointer: coarse) {
    .time-bar button { width: 44px; }
}

@media (max-width: 500px) {
    .canvas-dock {
        left: max(12px, env(safe-area-inset-left));
        right: max(12px, env(safe-area-inset-right));
        bottom: max(12px, env(safe-area-inset-bottom));
    }
}

/* A second bottom row gives playback the full width of a narrow canvas. */
@container (max-width: 740px) {
    .time-bar { grid-area: 2 / 1 / auto / -1; }
}

@container (max-width: 340px) {
    .time-bar { gap: 2px; }
    .time-bar .playback-toggle { width: 60px; }
    .time-bar button { width: 30px; }
    .time-bar [role="timer"] { min-width: 12ch; padding: 0 4px; font-size: 10px; }
}
